一、硬件信息及配套软件
1、硬件设置
RAC集群虚拟机:CPU:2C、内存:9G、操作系统:30G、数据库安装目录:100G
数据存储:50G (10G*5)
共享存储:2G (1G*2)
2、IP 划分
主机名 | 公有地址 | 私有地址 | VIP | 共享存储(SAN) |
rac1 | 192.168.87.131 | 10.10.10.131 | 192.168.87.133 | 192.168.87.129 |
rac2 | 192.168.87.132 | 10.10.10.132 | 192.168.87.134 | 192.168.87.129 |
3、配套软件
操作系统: OracleLinux-R7-U9-Server-x86_64-dvd
数据库软件:oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
数据库集群软件:LINUX.X64_193000_grid_home.zip
关注以下这三个rpm包
compat-libstdc++-33-3.2.3-71.el7.x86_64.rpm
libaio-devel-0.3.109-13.el7.x86_64.rpm
ksh-20120801-144.0.1.el7_9.x86_64.rpm
二、环境配置
1、主机名设置
主机:192.168.87.131
[root@rac1 ~]# hostnamectl set-hostname rac1
主机:192.168.87.132
[root@rac2 ~]# hostnamectl set-hostname rac2
主机:192.168.87.129
[root@san ~]# hostnamectl set-hostname san
2、主机名及网络设置
vi /etc/hosts
192.168.87.131 rac1
192.168.87.132 rac2
10.10.10.131 rac1prv
10.10.10.132 rac2prv
192.168.87.133 rac1vip
192.168.87.134 rac2vip
192.168.87.129 san
3、防火墙及SELINUX设置
关闭selinux
sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
setenforce 1
关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
4、进制NTP时钟服务禁止NTP
systemctl stop ntpd
systemctl disabled ntpd
systemctl stop chronyd.service
systemctl disable chronyd.service
rm -f /etc/chrony.conf
5、安装相关rpm包
yum 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
推荐安装以下命令
yum install -y lrzsz
yum install -y rsync
yum install -y telnet
yum install -y vim
yum install -y curl
yum install -y wget
yum install -y openssh-server
yum install -y openssh-clients
yum install -y lsof
三、部署Oracle--19C --RAC集群
1、rac1/rac2 安装预装软件
[root@rac1 opt]# rpm -ivh oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
安装完毕后会自动创建用户和组,不建议使用默认的配置
2、rac1/rac2重新创建oracle相关用户及组
userdel -r oracle
userdel -r grid
groupdel oinstall
groupdel dba
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 oracle
passwd oracle
passwd grid
检查核实用户
3、rac1/rac2创建oracle相关目录并赋权
mkdir /opt/oracle
mkdir -p /opt/oracle/app/grid
mkdir -p /opt/oracle/app/19c/grid
chown -R grid:oinstall /opt/oracle
mkdir -p /opt/oracle/app/oraInventory
chown -R grid:oinstall /opt/oracle/app/oraInventory
mkdir -p /opt/oracle/app/oracle/product/19c/dbhome_1
chown -R oracle:oinstall /opt/oracle/app/oracle
chmod -R 775 /opt/oracle
4、rac1/rac2设置grid用户环境变量
vi ~/.bash_profile
umask 022
#rac1
export ORACLE_SID=+ASM1
#rac2
export ORACLE_SID=+ASM1
export ORACLE_BASE=/opt/oracle/app/grid
export ORACLE_HOME=/opt/oracle/app/19c/grid
export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin
5、rac1/rac2设置oracle用户环境变量
[oracle@rac1 ~]$ vi ~/.bash_profile
umask 022
export ORACLE_BASE=/opt/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19c/dbhome_1
export ORACLE_UNQNAME=rac
export ORACLE_SID=rac1
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin
6、ASM共享存储配置
服务端执行
yum -y install nfs-utils rpcbind
[root@san ~]# vi /etc/exports
/asm *(insecure,rw,no_root_squash,no_all_squash,sync)
[root@san ~]# systemctl restart nfs-server.service
[root@san ~]#
[root@san ~]# showmount -e
Export list for san:
/asm *
[root@san ~]# exportfs -v
/asm <world>(sync,wdelay,hide,no_subtree_check,sec=sys,rw,insecure,no_root_squash,no_all_squash)
设置开机自启动
[root@san ~]# systemctl start rpcbind.service
[root@san ~]# systemctl start nfs-server.service
[root@san ~]# systemctl enable rpcbind.service
[root@san ~]# systemctl enable nfs-server.service
客户端配置
[root@rac1 opt]# yum -y install nfs-utils rpcbind
[root@rac1 opt]# mount -t nfs 192.168.87.129:/asm /asm
[root@rac2 opt]# mount -t nfs 192.168.87.129:/asm /asm
检查共享存储权限
[root@san ~]# ls -ld /asm/
drwxrwxrwx 3 777 root 4096 May 19 20:57 /asm/
配置开机启动
vi /etc/fstab
192.168.87.129:/asm nfs defaults 0 0
Linux使用nfs设置共享文件夹_linux配置nfs共享-CSDN博客
NFS共享存储主机执行
mkdir -p /asm/oracleasm/disks
dd if=/dev/zero of=/asm/oracleasm/disks/asm1 bs=8192k count=1280
dd if=/dev/zero of=/asm/oracleasm/disks/asm2 bs=8192k count=1280
dd if=/dev/zero of=/asm/oracleasm/disks/asm3 bs=8192k count=1280
dd if=/dev/zero of=/asm/oracleasm/disks/asm4 bs=8192k count=1280
dd if=/dev/zero of=/asm/oracleasm/disks/asm5 bs=8192k count=1280
dd if=/dev/zero of=/asm/oracleasm/disks/asm6 bs=8192k count=128
dd if=/dev/zero of=/asm/oracleasm/disks/asm7 bs=8192k count=128
rac1/rac2 主机执行
chown grid:asmadmin /asm/oracleasm/disks/asm1
chown grid:asmadmin /asm/oracleasm/disks/asm2
chown grid:asmadmin /asm/oracleasm/disks/asm3
chown grid:asmadmin /asm/oracleasm/disks/asm4
chown grid:asmadmin /asm/oracleasm/disks/asm5
chown grid:asmadmin /asm/oracleasm/disks/asm6
chown grid:asmadmin /asm/oracleasm/disks/asm7
检查权限设置
[root@san ~]# chmod -R 777 /asm/
7、安装数据库集群软件-grid
rac1主机解压 LINUX.X64_193000_grid_home.zip
[grid@rac1 ~]$ cd $ORACLE_HOME
[grid@rac1 grid]$ pwd
/opt/oracle/app/19c/grid
#需要在页面执行
[grid@rac1 ~]$ ./gridSetup.sh