RHEL 7.6 安装 Oracle 18c RAC
第一部分 安装规划
虚拟环境
VirtualBox 6.0
OS 版本
Red Hat Enterprise Linux Server release 7.6 (Maipo)
数据库版本
18.3.0.0.0
安装介质
LINUX.X64_180000_db_home.zip
LINUX.X64_180000_grid_home.zip
软件安装目录
grid: /u01/app/18.0.0/grid
oracle: /u01/app/oracle/product/18.0.0/db_1
用户和组
grid: oinstall,asmadmin,asmdba,racdba,asmoper
oracle: oinstall, dba,asmdba,backupdba,dgdba,kmdba,racdba,oper
网络规划
192.168.56.11 rac1 #一节点public ip
192.168.56.12 rac2 #二节点public ip
192.168.56.13 rac1-vip #一节点virtual ip
192.168.56.14 rac2-vip #二节点virtual ip
172.16.56.11 rac1-priv #一节点private ip
172.16.56.12 rac2-priv #二节点private ip
192.168.56.15 rac-scan # scan ip
ASM磁盘组
OCRVT: 2G * 3
MGMT: 40G * 1
DATA: 8G * 1
ARCH: 5G * 1
安装操作系统,添加ASM共享磁盘省略
第二分部 操作系统环境配置
2.1 更改IO调度为deadline,关闭numa和透明大页
(1).vi /etc/default/grub(编辑 /etc/default/grub 文件,在GRUB_CMDLINE_LINUX 条目后面添加"elevator=deadline","transparent_hugepage=never" 和”numa=off”,
执行grub2-mkconfig -o /boot/grub2/grub.cfg 最后重启操作系统)
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rootvg/root rd.lvm.lv=rootvg/swap rhgb quiet elevator=deadline transparent_hugepage=never numa=off net.ifnames=0 biosdevname=0"
grub2-mkconfig -o /boot/grub2/grub.cfg
(2). 重启操作系统使配置生效.
2.2 使用CTSS时钟同步
/sbin/service ntpd stop
chkconfig ntpd off
mv /etc/ntp.conf /etc/ntp.conf.org
systemctl stop chronyd
systemctl disable chronyd
2.3 配置/etc/hosts解析表
vi /etc/hosts添加
config for 18c RAC
192.168.56.11 rac1
192.168.56.12 rac2
192.168.56.13 rac1-vip
192.168.56.14 rac2-vip
172.16.56.11 rac1-priv
172.16.56.12 rac2-priv
192.168.56.15 rac-scan
2.4 关闭防火墙
systemctl disable firewalld.service
systemctl stop firewalld.service
2.5 关闭selinux
vi /etc/selinux/config
SELINUX=disabled
2.6 关闭NetworkManager
systemctl disable NetworkManager
systemctl stop NetworkManager
2.7 停止avahi-daemon
systemctl stop avahi-daemon.socket avahi-daemon.service
systemctl disable avahi-daemon.socket avahi-daemon.service
2.8 配置NOZEROCONF
vi /etc/sysconfig/network 添加
NOZEROCONF=yes
2.9 内核参数修改
vi /etc/sysctl.conf
kernel configuration for oracle 18c
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 268435456
kernel.shmmax = 549755813760
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
2.10 添加用户和组
/usr/sbin/groupadd -g 54321 oinstall
/usr/sbin/groupadd -g 54322 dba
/usr/sbin/groupadd -g 54323 oper
/usr/sbin/groupadd -g 54324 backupdba
/usr/sbin/groupadd -g 54325 dgdba
/usr/sbin/groupadd -g 54326 kmdba
/usr/sbin/groupadd -g 54327 asmdba
/usr/sbin/groupadd -g 54328 asmoper
/usr/sbin/groupadd -g 54329 asmadmin
/usr/sbin/groupadd -g 54330 racdba
/usr/sbin/useradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle
/usr/sbin/useradd -u 54322 -g oinstall -G asmadmin,asmdba,racdba,asmoper grid
echo oracle | passwd --stdin oracle
echo oracle | passwd --stdin grid
2.11 创建软件安装目录
mkdir -p /u01/app/18.0.0/grid
mkdir -p /u01/app/grid
mkdir -p /u01/app/oracle/product/18.0.0/db_1
chown -R grid:oinstall /u01
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/
2.12 用户环境变量配置
为grid用户添加环境变量
vi /home/grid/.bash_profile EOF
export ORACLE_BASE=/u01/app/grid
export ORACLE_SID=+ASM1 (节点2改为+ASM2)
export ORACLE_HOME=/u01/app/18.0.0/grid
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
EOF
source /home/grid/.bash_profile
为oracle用户添加环境变量
vi /home/oracle/.bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_SID=racdb1(节点2改为racdb2)
export ORACLE_HOME=$ORACLE_BASE/product/18.0.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
EOF
source /home/oracle/.bash_profile
2.13 配置用户资源限制
vi /etc/security/limits.conf 添加
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard memlock 3145728
oracle soft memlock 3145728
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
grid hard memlock 3145728
grid soft memlock 3145728
vi /etc/pam.d/login 添加
this is for oracle user
session required pam_limits.so
2.14 配置全局profile
vi /etc/profile 添加
this is for oracle user
if [ $USER = "oracle" ]||[ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
2.15 安装rpm依赖包
yum -y install bc \
binutils \
compat-libcap1 \
compat-libstdc++-33.i686 \
compat-libstdc++-33.x86_64 \
glibc.i686 \
glibc.x86_64 \
glibc-devel.i686 \
glibc-devel.x86_64 \
ksh \
libaio.i686 \
libaio.x86_64 \
libaio-devel.i686 \
libaio-devel.x86_64 \
libX11.i686 \
libX11.x86_64 \
libXau.i686 \
libXau.x86_64 \
libXi.i686 \
libXi.x86_64 \
libXtst.i686 \
libXtst.x86_64 \
libXrender-devel.i686 \
libXrender-devel.x86_64 \
libXrender.i686 \
libXrender.x86_64 \
libgcc.i686 \
libgcc.x86_64 \
libstdc++.i686 \
libstdc++.x86_64 \
libstdc++-devel.i686 \
libstdc++-devel.x86_64 \
libxcb.i686 \
libxcb.x86_64 \
make \
nfs-utils.x86_64 \
net-tools \
python \
python-configshell \
python-rtslib \
python-six \
smartmontools \
sysstat \
targetcli \
unixODBC \
unixODBC-devel \
unzip
CVUQDISK_GRP=oinstall; export CVUQDISK_GRP
rpm -iv /u01/app/18.0.0/grid/cvuqdisk-1.0.10-1.rpm (需先解压grid安装包到/u01/app/18.0.0/grid)
2.16 共享存储配置
(1).多路径方式安装配置
yum -y install device-mapper*
--生成默认配置文件
mpathconf --enable
vi /etc/multipath.conf 修改
find_multipaths no
multipaths {
multipath {
wwid 14f504e46494c455257374a5968312d784f45542d54754171
alias OCR1
}
multipath {
wwid 14f504e46494c455257374a5968312d784f45542d54754172
alias OCR2
}
multipath {
wwid 14f504e46494c455257374a5968312d784f45542d54754173
alias OCR3
}
multipath {
wwid 14f504e46494c455257374a5968312d784f45542d54754174
alias MGMT
}
multipath {
wwid 14f504e46494c4552325354736c632d783567742d47557662
alias DATA
}
multipath {
wwid 14f504e46494c45526a62644c70392d65744b562d38524967
alias ARCH
}
}
multipath -F
systemctl restart multipathd.service
multipath -v3
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c455257374a5968312d784f45542d54754171",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c455257374a5968312d784f45542d54754172",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c455257374a5968312d784f45542d54754173",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c455257374a5968312d784f45542d54754174",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c4552325354736c632d783567742d47557662",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="dm-*",ENV{DM_UUID}=="mpath-14f504e46494c45526a62644c70392d65744b562d38524967",OWNER="grid",GROUP="asmadmin",MODE="0660"
udevadm trigger
udevadm control -R
systemctl restart systemd-udevd.service
(2).不使用多路径的方式,仅需配置如下文件
vi /etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB5643659c-65a9d79a",SYMLINK+="asm-diskb",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB603d9ec9-7c3a2db0",SYMLINK+="asm-diskc",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBc74f578a-aa1a566c",SYMLINK+="asm-diskd",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBcje8jg2a-ff4e14d3",SYMLINK+="asm-diske",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBcaeggcdb-3gv5hnc6",SYMLINK+="asm-diskf",OWNER="grid",GROUP="asmadmin",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block",PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBccbd112b-egdgrkr5",SYMLINK+="asm-diskg",OWNER="grid",GROUP="asmadmin",MODE="0660"
使udev策略配置生效
udevadm trigger
udevadm control -R
systemctl restart systemd-udevd.service
[root@rac1 ~]# ll /dev/asm*
lrwxrwxrwx 1 root root 3 Mar 25 14:53 /dev/asm-diskb -> sdb
lrwxrwxrwx 1 root root 3 Mar 25 14:53 /dev/asm-diskc -> sdc
lrwxrwxrwx 1 root root 3 Mar 25 15:06 /dev/asm-diskd -> sdd
lrwxrwxrwx 1 root root 3 Mar 25 15:06 /dev/asm-diske -> sde
lrwxrwxrwx 1 root root 3 Mar 25 15:06 /dev/asm-diskf -> sdf
[root@rac1 ~]# ll /dev/sd*
brw-rw---- 1 grid asmadmin 8, 16 Mar 25 15:07 /dev/sdb
brw-rw---- 1 grid asmadmin 8, 32 Mar 25 15:07 /dev/sdc
brw-rw---- 1 grid asmadmin 8, 48 Mar 25 15:07 /dev/sdd
brw-rw---- 1 grid asmadmin 8, 64 Mar 25 15:07 /dev/sde
brw-rw---- 1 grid asmadmin 8, 80 Mar 25 15:07 /dev/sdf
第三部分 安装GRID软件
3.1 解压软件
unzip LINUX.X64_180000_grid_home.zip -d /u01/app/18.0.0/grid
3.2 配置用户ssh对等性(方便检查rac2节点配置,也可以OUI界面配置)
su - grid
cd /u01/app/18.0.0/grid/oui/prov/resources/scripts
./sshUserSetup.sh -user grid -hosts "rac1 rac2" -advanced –noPromptPassphrase
3.3 安装前环境预检查
su - grid
cd /u01/app/18.0.0/grid
./runcluvfy.sh stage -pre crsinst -n rac1,rac2 -fixup –verbose
3.4 开始安装grid软件
export DISPLAY=192.168.56.1:0.0
cd /u01/app/18.0.0/grid
./gridSetup.sh
分别在rac1,rac2执行上面2个脚本
执行完成后,点击OK继续完成安装。
INS-20802 报错可以忽略
至此grid软件安装完成。
第四部分 创建ASM磁盘组
su - grid
export DISPLAY=192.168.56.1:0.0
asmca
创建DATA和ARCH磁盘组
第五部分 安装database软件
5.1 解压db软件
su - oracle
unzip /soft/LINUX.X64_180000_db_home.zip –d /u01/app/oracle/product/18.0.0/db_1
5.2 开始安装db软件
su - oracle
export DISPLAY=192.168.56.1:0.0
cd /u01/app/oracle/product/18.0.0/db_1
./runInstaller
如果前面没有配置oracle用户的ssh对等性,则输入oracle用户密码,点击setup进行配置
分别在rac1,rac2节点执行/u01/app/oracle/product/18.0.0/db_1/root.sh脚本
至此database软件安装完成。
第六部分 创建数据库
su - oracle
export DISPLAY=192.168.56.1:0.0
dbca
至此dbca创建数据库完成。