1.disable SELinux
cat /etc/selinux/config|grep -v ^#|grep -v ^$ SELINUX=disabled SELINUXTYPE=targeted
2.创建账号
groupadd -g 5001 oinstall groupadd -g 5002 dba groupadd -g 5003 asmdba groupadd -g 5004 asmoper groupadd -g 5005 asmadmin useradd -u 6001 -g oinstall -G asmadmin,asmdba,asmoper grid useradd -u 6002 -g oinstall -G dba,asmadmin,asmdba oracle echo "password" |passwd --stdin grid echo "password" |passwd --stdin oracle
3.安装包
yum -y install xdpyinfo yum -y install libnsl
4.安装目录
mkdir -p /oracle/app/grid mkdir -p /oracle/app/19c/grid chown -R grid:oinstall /oracle mkdir -p /oracle/app/oraInventory chown -R grid:oinstall /oracle/app/oraInventory mkdir -p /oracle/app/oracle/19c/ chown -R oracle:oinstall /oracle/app/oracle chmod -R 775 /oracle
5.配置grid 用户环境
cat ~/.bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi umask 022 export ORACLE_SID=+ASM export ORACLE_BASE=/oracle/app/grid export ORACLE_HOME=/oracle/app/19c/grid export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin export CV_ASSUME_DISTID=RHEL7.6;export CV_ASSUME_DISTID export NLS_LANG=AMERICAN_AMERICA.UTF8;export NLS_LANG # User specific environment and startup programs
oracle 用户环境
cat ~/.bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi umask 022 export ORACLE_BASE=/oracle/app/oracle export ORACLE_HOME=$ORACLE_BASE/19c/ export ORACLE_UNQNAME=mtxdb export ORACLE_SID=mtxdb export NLS_LANG=AMERICAN_AMERICA.UTF8 export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin
6. 资源配置
cat << EOF >>/etc/sysctl.conf fs.file-max = 6815744 kernel.sem = 250 32000 100 128 kernel.shmmni = 4096 kernel.shmall = 1073741824 kernel.shmmax = 4398046511104 kernel.panic_on_oops = 1 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 net.ipv4.conf.all.rp_filter = 2 net.ipv4.conf.default.rp_filter = 2 fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500 EOF
7.limit配置
cat << EOF >> /etc/security/limits.conf oramtx soft nproc 16384 oramtx hard nproc 16384 oramtx soft nofile 16384 oramtx hard nofile 65536 oramtx soft stack 10240 oramtx hard stack 32768 oramtx hard memlock 8000000 oramtx soft memlock 8000000 oracle soft nproc 16384 oracle hard nproc 16384 oracle soft nofile 16384 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 32768 oracle hard memlock 8000000 oracle soft memlock 8000000 oralu8 soft nproc 16384 oralu8 hard nproc 16384 oralu8 soft nofile 16384 oralu8 hard nofile 65536 oralu8 soft stack 10240 oralu8 hard stack 32768 oralu8 hard memlock 8000000 oralu8 soft memlock 8000000 * soft core 65536 * hard rss 65536 * hard nproc 65536 * soft nproc 65536 EOF
8.udev 磁盘
参阅 https://www.cnblogs.com/tingxin/p/13177268.html
9.安装在grid 用户下
[grid@mtxdb grid]$ cd $ORACLE_HOME [grid@mtxdb grid]$ ./gridSetup.sh Launching Oracle Grid Infrastructure Setup Wizard...
/oracle/app/19c/grid/root.sh Performing root user operation. The following environment variables are set as: ORACLE_OWNER= grid ORACLE_HOME= /oracle/app/19c/grid Enter the full pathname of the local bin directory: [/usr/local/bin]: The contents of "dbhome" have not changed. No need to overwrite. The contents of "oraenv" have not changed. No need to overwrite. The contents of "coraenv" have not changed. No need to overwrite. Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. Using configuration parameter file: /oracle/app/19c/grid/crs/install/crsconfig_params The log of current session can be found at: /oracle/app/grid/crsdata/mtxdb/crsconfig/roothas_2020-06-23_05-03-56PM.log LOCAL ADD MODE Creating OCR keys for user 'grid', privgrp 'oinstall'.. Operation successful. LOCAL ONLY MODE Successfully accumulated necessary OCR keys. Creating OCR keys for user 'root', privgrp 'root'.. Operation successful. CRS-4664: Node mtxdb successfully pinned. 2020/06/23 17:04:08 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service' mtxdb 2020/06/23 17:06:56 /oracle/app/grid/crsdata/mtxdb/olr/backup_20200623_170656.olr 724960844 2020/06/23 17:06:56 CLSRSC-327: Successfully configured Oracle Restart for a standalone server
10.设置root用户环境
cat ~/.bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/bin:/oracle/app/19c/grid/bin export PATH
11.验证:
[root@mtxdb ~]# crsctl stop has CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'mtxdb' CRS-2673: Attempting to stop 'ora.DATA.dg' on 'mtxdb' CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'mtxdb' CRS-2677: Stop of 'ora.DATA.dg' on 'mtxdb' succeeded CRS-2673: Attempting to stop 'ora.asm' on 'mtxdb' CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'mtxdb' succeeded CRS-2677: Stop of 'ora.asm' on 'mtxdb' succeeded CRS-2673: Attempting to stop 'ora.evmd' on 'mtxdb' CRS-2677: Stop of 'ora.evmd' on 'mtxdb' succeeded CRS-2673: Attempting to stop 'ora.cssd' on 'mtxdb' CRS-2677: Stop of 'ora.cssd' on 'mtxdb' succeeded CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'mtxdb' has completed CRS-4133: Oracle High Availability Services has been stopped. [root@mtxdb ~]# crsctl start has CRS-4123: Oracle High Availability Services has been started. [root@mtxdb ~]# crsctl status res -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATA.dg ONLINE OFFLINE mtxdb STABLE ora.LISTENER.lsnr ONLINE ONLINE mtxdb STABLE ora.asm ONLINE OFFLINE mtxdb Instance Shutdown,ST ABLE ora.ons OFFLINE OFFLINE mtxdb STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.cssd 1 ONLINE OFFLINE mtxdb STARTING ora.diskmon 1 ONLINE ONLINE mtxdb STABLE ora.evmd 1 ONLINE INTERMEDIATE mtxdb STABLE --------------------------------------------------------------------------------
[root@mtxdb ~]# crsctl disable has --关闭开机启动 CRS-4621: Oracle High Availability Services autostart is disabled. [root@mtxdb ~]# crsctl enable has --打开开机启动 CRS-4622: Oracle High Availability Services autostart is enabled.