一.准备
1.安装rpm依赖包
# yum -y install bc gcc gcc-c++ binutils make gdb cmake glibc ksh elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc-devel libaio libaio-devel libXrender libXrender-devel libX11 libXau sysstat libXi libXtst libgcc librdmacm-devel libstdc++ libstdc++-devel libxcb net-tools nfs-utils compat-libcap1 compat-libstdc++ smartmontools targetcli python python-configshell python-rtslib python-six unixODBC unixODBC-devel
# for i in bc gcc gcc-c++ binutils make gdb cmake glibc ksh elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc-devel libaio libaio-devel \
libXrender libXrender-devel libX11 libXau sysstat libXi libXtst libgcc librdmacm-devel libstdc++ libstdc++-devel libxcb net-tools nfs-utils compat-libcap1 \
compat-libstdc++ smartmontools targetcli python python-configshell python-rtslib python-six unixODBC unixODBC-devel
do
rpm -q $i &>/dev/null || F="$F $i"
done ;echo $F;unset F
2.配置host
#vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.88.11 rac19c1
192.168.88.12 rac19c2
192.168.88.13 rac19c1-vip
192.168.88.14 rac19c2-vip
192.168.88.15 rac19c-scan
10.10.10.11 rac19c1-priv
10.10.10.12 rac19c2-priv
3.禁用防火墙和selinux
# systemctl stop firewalld
# systemctl disable firewalld
# setenforce 0
# vi /etc/selinux/config 设置为disabled
4.禁用NTP
# systemctl stop ntpd.service
# systemctl disable ntpd.service
# mv /etc/ntp.conf /etc/ntp.conf.orig
# systemctl status ntpd
5.关闭时间同步
# systemctl stop chronyd
# systemctl disable chronyd
# mv /etc/chrony.conf /etc/chrony.conf.bak
# echo "NOZEROCONF=yes" >>/etc/sysconfig/network
6.停止avahi-daemon服务
# systemctl disable avahi-daemon.socket
# systemctl disable avahi-daemon.service
# ps -ef|grep avahi-daemon
avahi 2679 1 0 18:28 ? 00:00:00 avahi-daemon: running [linux.local]
avahi 2686 2674 0 18:28 ? 00:00:00 avahi-daemon: chroot helper
# kill -9 2679 2686
# ps -ef|grep avahi-daemon
root 16254 15578 0 18:45 pts/1 00:00:00 grep --color=auto avahi-daemon
7.创建用户
# groupadd -g 11001 oinstall
# groupadd -g 11002 dba
# groupadd -g 11003 oper
# groupadd -g 11004 backupdba
# groupadd -g 11005 dgdba
# groupadd -g 11006 kmdba
# groupadd -g 11007 asmdba
# groupadd -g 11008 asmoper
# groupadd -g 11009 asmadmin
# groupadd -g 11010 racdba
# useradd -u 11011 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle
# useradd -u 11012 -g oinstall -G asmadmin,asmdba,asmoper,dba grid
8.创建所需要目录
# mkdir -p /u01/app/19.0.0/grid
# mkdir -p /u01/app/grid
# mkdir -p /u01/app/oracle
# mkdir -p /u01/app/oracle/product/19.0.0/db_1
# chown -R grid:oinstall /u01/app/grid
# chown -R grid:oinstall /u01/app/19.0.0/grid
# chown -R oracle:oinstall /u01/app/oracle
# chmod -R 775 /u01/
9.配置资源限制
1)
#vi /etc/security/limits.d/20-nproc.conf
#附加如下行
* - nproc 16384
2)
# cat /etc/security/limits.conf
# End of file
grid soft nproc 16384
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
grid hard stack 32768
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 4194304
oracle soft memlock 4194304
#memlock应该比略小于内存,单位:k。
3)
# vi /etc/pam.d/login
-session optional pam_ck_connector.so
#ORACLE SETTING
session required pam_limits.so
10.设置系统参数
# vi /etc/sysctl.conf
#附加如下行
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 268435456
kernel.shmmax = 1099511627776
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
# sysctl -p
11.配置环境变量
1)grid
# vi /home/grid/.bash_profile
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export ORACLE_SID=+ASM1;
export ORACLE_BASE=/u01/app/grid;
export ORACLE_HOME=/u01/app/19.0.0/grid;
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS";
export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
2)oracle
# vi /home/oracle/.bash_profile
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/db_1
export ORACLE_SID=RACDB1
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/local/bin
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
12.配置共享磁盘权限
# /usr/lib/udev/scsi_id -g -u -d /dev/sdb
36000c294347acba383e23ecbd43867c4
# /usr/lib/udev/scsi_id -g -u -d /dev/sdc
36000c2913d3b49354c9d030816bd5de9
[root@rac19c1 oracle]#
1)不配置多路径
# vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sdb", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$name",RESULT=="36000c294347acba383e23ecbd43867c4",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="sdc", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d /dev/$name",RESULT=="36000c2913d3b49354c9d030816bd5de9",OWNER="grid",GROUP="asmadmin",MODE="0660"
# /sbin/partprobe
# systemctl restart systemd-udev-trigger.service
# cd /dev/
# ll |grep asm
2)配置多路径(multipath)
# vi /etc/multipath.conf
multipaths {
multipath {
wwid 36000c294347acba383e23ecbd43867c4
alias asm-ocr1
}
multipath {
wwid 36000c2913d3b49354c9d030816bd5de9
alias asm-data11
}
}
# vi /etc/udev/rules.d/12-dm-permissions.rules
ENV{DM_NAME}=="asm-ocr1",OWNER:="grid",GROUP:="asmadmin",MODE:="660",SYMLINK+="mapper/$env{DM_NAME}"
ENV{DM_NAME}=="asm-data11",OWNER:="grid",GROUP:="asmadmin",MODE:="660",SYMLINK+="mapper/$env{DM_NAME}"
--注:
1)这里,SYMLINK+="mapper/$env{DM_NAME}"中的mapper,相对于/dev/路径。
# systemctl start multipathd.service
# multipath -ll
# /sbin/udevadm trigger --type=devices --action=change
# cd /dev
# ll |grep dm
13.配置互信
1)grid
# su - grid
$ cd /home/grid
$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
$ ssh-keygen -t rsa
$ ssh-keygen -t dsa
$ cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
$ cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
$ ssh rac19c2 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
$ ssh rac19c2 cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
$ scp ~/.ssh/authorized_keys rac19c2:~/.ssh/authorized_keys
$ ssh rac19c1 date;ssh rac19c2 date;ssh rac19c1-priv date;ssh rac19c2-priv date
2)oracle
# su - oracle
$ cd /home/oracle
$ mkdir ~/.ssh
$ chmod 700 ~/.ssh
$ ssh-keygen -t rsa
$ ssh-keygen -t dsa
$ cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
$ cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
$ ssh rac19c2 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
$ ssh rac19c2 cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
$ scp ~/.ssh/authorized_keys rac19c2:~/.ssh/authorized_keys
$ ssh rac19c1 date;ssh rac19c2 date;ssh rac19c1-priv date;ssh rac19c2-priv date
14.在grid安装文件中安装 cvuqdisk
# pwd
/u01/app/19.0.0/grid/cv/rpm
# ls
cvuqdisk-1.0.10-1.rpm
# rpm -ivh cvuqdisk-1.0.10-1.rpm
二、安装grid
1.开始安装grid
# su - grid
$ cd $ORACLE_HOME
$ ls
$ ./gridSetup.sh
1)选Configure Oracle Grid infrastrcuture for a New Cluster
2)选Configuer an Oracle Standalone Cluster
3)选Create Local Scan:rac19c-->rac19c-scan-->1521
6)选Use Oracle Flex ASM for Storage
7)Configure Grid Infrastructure Management Repository:选NO
10)选Do not use Inteligent Platform Manaqement Interface(IPMI)
12)选填ASM相关OS组:asmadmin-->asmdba-->asmoper
13)选填Oracle Inventory Directory
2.以root执行脚本
[root@rac19c1]# sh /u01/app/oraInventory/orainstRoot.sh
[root@rac19c2]# sh /u01/app/oraInventory/orainstRoot.sh
[root@rac19c1]# sh /u01/app/19.0.0/grid/root.sh
[root@rac19c2]# sh /u01/app/19.0.0/grid/root.sh
3.查看状态
$ crsctl stat res -t
三.安装Oracle软件
1.开始安装Oracle软件
# su - oracle
$ cd $ORACLE_HOME
$ ls
$ pwd
$ ./runInstaller
1)选Set Up Software Only
2)选Oracle Real Application Clusters database Installation
6)选填Oracle软件相关OS组:dba-->oper-->backupdba-->dgdba-->kmdba-->racdba
11)点击OK
2.以root运行两个脚本
[root@rac19c1]# sh /u01/app/oracle/product/19.0.0/db_1/root.sh
[root@rac19c2]# sh /u01/app/oracle/product/19.0.0/db_1/root.sh
四.创建ASM数据磁盘
# su - grid
$ asmca
点击选择左侧"Disk Groups "-->输入磁盘组名-->选填盘组相关属性-->选填磁盘-->点击"OK"
五.创建数据库
# su - oracle
$ dbca
1)选create a database
3)选Oracle Real Application Cluster(RAC) database+Admin Managed+General Purpose or Transaction Processing
5)选填global database name和sid prefix
六.查看RAC状态
[grid@rac19c2 ~]$ crsctl stat res -t