此为"一森咖记"公众号——第28篇文章】
【前言】
《干货:RHEL7.1环境下双节点Oracle RAC搭建实操》
上述文章讲述了11g rac在RHEL7.1下的部署实施。
有朋友就问道:版本 11.2.0.4 Oracle官方提供扩展性支持服务截止时间31-Dec-2020,可以讲讲12c(包含)以上18c和19c的配置实施。当然/必须可以,大家的需求就是努力方向;鉴于此需求,有了此文。
大家先从下三幅图可以看到目前常用的11g,12c,18c,19c的support lifetime:
来源1:
图来源:MOS Note: 742060.1.: Release Schedule of Current Database Releases
https://support.oracle.com/epmos/faces/DocumentDisplay?_afrLoop=471657337872333&id=742060.1&_afrWindowMode=0&_adf.ctrl-state=l8r4wijjt_348
来源2:
http://www.oracle.com/us/support/library/lifetime-support-technology-069183.pdf
上三图内容小结:
1. 11.2.0.4 的Extended Support Ends (ES)的截止时间:31-Dec-2020;
2. 12.2.0.1 Release Family 12.2 的Lifetime Support的Extended Support Ends的截止时间为:Mar 2026;
3. 18c Release Family 12.2 的Premier Support Ends (PS)截止日期为:20-Nov-2020 for Patching,31-Mar-2023 for all other Support Offerings;
4. 19c Terminal Release for 12.2 FamilyExtended Support Ends (ES)的截止时间为31-Mar-2026
建议:
如果大家要升级Oracle版本,单从Oracle可提供的服务生命周期一项考虑,建议推荐使用12.2或者直接搞到19c版本。
考虑到12c、18c、19c的多租户等新特性的延续和相似性,本文将讲述RHEL7.2环境下双节点12c RAC搭建实操,为了简单明洁的表述清整个配置过程,本文将不再贴出详细的安装步骤截图,只将全面、详细的可实施操作命令进行展示。
详细的具体截图可参考/借鉴本人以下推文:
《干货:RHEL7.1环境下双节点Oracle RAC搭建实操》
注意:
本文的12c安装使用的是non-pdbs 非多租户形式。
如下为配置步骤:
一、建立用户
#/usr/sbin/groupadd -g 501 oinstall
#/usr/sbin/groupadd -g 502 dba
#/usr/sbin/groupadd -g 504 asmadmin
#/usr/sbin/groupadd -g 506 asmdba
#/usr/sbin/groupadd -g 507 asmoper
#/usr/sbin/useradd -u 501 -g oinstall -G asmadmin,asmdba,asmoper grid
#/usr/sbin/useradd -u 502 -g oinstall -G dba,asmdba oracle
二、修改/ETC/HOSTS
注意这里面 127.0.0.1 一定要这么写,不然2节点root.sh可能出 ctss错误 ctss 超时默认是10分钟。
cat > etc/hosts <<EOF
127.0.0.1 localhost localhost.localdomain
# Public IP
192.168.0.120 ethan-rac1
192.168.0.121 ethan-rac2
#Private IP
192.168.20.10 ethan-rac1-priv
192.168.20.11 ethan-rac2-priv
#Virtual IP
192.168.0.122 ethan-rac1-vip
192.168.0.123 ethan-rac2-vip
# SCAN IP
192.168.0.124 ethan-clus-scanvip
EOF
三、配置内核参数
cat >> /etc/sysctl.conf <<EOF
kernel.shmall = 67377299456
kernel.shmmax = 269509197824
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
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
fs.aio-max-nr = 1048576
vm.swappiness = 1
vm.min_free_kbytes = 51200
EOF
[root@ethanDB-rac1 ~]# sbin/sysctl -p
四、Set shell limits for the oracle user
1. Add the following lines to the etc/security/limits.conf file:
cat >> etc/security/limits.conf <<EOF
grid soft nofile 1024
grid hard nofile 65536
grid soft nproc 2047
grid hard nproc 16384
grid soft stack 10240
grid hard stack 32768
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
grid soft memlock unlimited
grid hard memlock unlimited
oracle soft memlock unlimited
oracle hard memlock unlimited
EOF
2. Add or edit the following line in the etc/pam.d/login file, if it does not already exist:
cat >> /etc/pam.d/login <<EOF
session required pam_limits.so
EOF
3. Make the following changes to the default shell startup file, add the following lines to the etc/profile file:
cat >> etc/profile <<EOF
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
EOF
五、建立相关目录
mkdir -p oracle/app/oracle
mkdir -p oracle/app/grid
mkdir -p oracle/app/12.2.1/
chown -R grid:oinstall oracle/app/12.2.1/
chown -R oracle:oinstall oracle/app/oracle
chmod -R 775 oracle/app
chown root:oinstall oracle/app
chown -R grid:oinstall oracle/app/grid
六、配置用户环境变量
----GRID 用户
# Grid Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
GRID_HOME=/oracle/app/12.2.1; export GRID_HOME
ORACLE_HOME=/oracle/app/12.2.1; export ORACLE_HOME
ORACLE_SID=+ASM1; export ORACLE_SID
PATH=/usr/sbin:$PATH; export PATH
PATH=$GRID_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
----oracle 用户
# Oracle Settings
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/oracle/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.2.1/dbhome_1/; export ORACLE_HOME
ORACLE_SID=ethan1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
七、下载GI和Oracle 软件
将gird soft和12c的database下载后,放于/oracle/app下
下载地址为:
https://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html
八、检查需要的包
[root@ethanDB-rac1 ~]# yum -y install binutils compat-libstdc++-33 elfutils-libelf \
elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common \
glibc-devel kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel \
make numactl-devel sysstat unixODBC unixODBC-devel pdksh compat-libcap1
九、关闭防火墙
[root@ethanDB-rac1 ~]# systemctl stop firewalld
[root@ethanDB-rac1 ~]# systemctl disable firewalld
十、关闭SELINUX
[root@ethanDB-rac1 ~]# vi /etc/selinux/config
SELINUX=disable
十一、关闭透明大页
详看关闭原因和方法详见本人推文:
临时关闭
[root@ethanDB-rac1 ~]#echo never> /sys/kernel/mm/transparent_hugepage/enabled
[root@ethanDB-rac1 ~]# cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
永久关闭:
[root@ethanDB-rac1 ~]# vi /etc/default/grub
GRUB_CMDLINE_LINUX="crashkernel=auto
rd.lvm.lv=vg_root/lv_root
rd.lvm.lv=vg_root/lv_swap rhgb quiet transparent_hugepage=never"
十二、配置UDEV 绑定多路径
Step 1: Determine the UUID of the multipath disk meant for Oracle ASM use.
[root@ethanDB-rac1 ~]# udevadm info --query=all --name=/dev/mapper/mpatha | grep -i DM_UUID
[root@ethanDB-rac1 ~]# udevadm info --query=all --name=/dev/mapper/mpatha | grep -i DM_UUID
E: DM_UUID=mpath-360002ac0000000000000003a00019a05
[root@ethanDB-rac1 ~]# udevadm info --query=all --name=/dev/mapper/mpathb | grep -i DM_UUID
E: DM_UUID=mpath-360002ac0000000000000003b00019a05
[root@ethanDB-rac1 ~]# udevadm info --query=all --name=/dev/mapper/mpathc | grep -i DM_UUID
E: DM_UUID=mpath-360002ac0000000000000003c00019a05
[root@ethanDB-rac1 ~]# udevadm info --query=all --name=/dev/mapper/mpathd | grep -i DM_UUID
E: DM_UUID=mpath-360002ac0000000000000003d00019a05
[root@ethanDB-rac1 ~]# udevadm info --query=all --name=/dev/mapper/mpathe | grep -i DM_UUID
E: DM_UUID=mpath-360002ac0000000000000003e00019a05
[root@ethanDB-rac1 ~]# udevadm info --query=all --name=/dev/mapper/mpathf | grep -i DM_UUID
E: DM_UUID=mpath-360002ac0000000000000004000019a05
Note: In the above command is /dev/mapper/mpathn1 is just an example multipath disk, in you case it may be different.
Step 2: Create a udev rule file /etc/udev/rules.d/96-asmmultipath.rules
# touch /etc/udev/rules.d/96-asmmultipath.rules
Step 3: Add below udev rule for a multipath device using it's DM_UUID value under the file /etc/udev/rules.d/96-asmmultipath.rules
ACTION=="add|change", ENV{DM_UUID}=="mpath-360002ac0000000000000004000019a05", SYMLINK+="asmdiskmgmt", GROUP="asmadmin", OWNER="grid", MODE="0660"
ACTION=="add|change", ENV{DM_UUID}=="mpath-360002ac0000000000000003c00019a05", SYMLINK+="asmdiskocr1", GROUP="asmadmin", OWNER="grid", MODE="0660"
ACTION=="add|change", ENV{DM_UUID}=="mpath-360002ac0000000000000003d00019a05", SYMLINK+="asmdiskocr2", GROUP="asmadmin", OWNER="grid", MODE="0660"
ACTION=="add|change", ENV{DM_UUID}=="mpath-360002ac0000000000000003e00019a05", SYMLINK+="asmdiskocr3", GROUP="asmadmin", OWNER="grid", MODE="0660"
ACTION=="add|change", ENV{DM_UUID}=="mpath-360002ac0000000000000003a00019a05", SYMLINK+="asmdiskethanDB", GROUP="asmadmin", OWNER="grid", MODE="0660"
ACTION=="add|change", ENV{DM_UUID}=="mpath-360002ac0000000000000003b00019a05", SYMLINK+="asmdiskarch", GROUP="asmadmin", OWNER="grid", MODE="0660"
这里贴下文章中
《干货:RHEL7.1环境下双节点Oracle RAC搭建实操》
11g rac的绑定dm-*
划重点:
本文12c和之前的11g rac部署最大的不同是本文udev的配置,读者可详细看下;11g中绑定是dm-*,但鉴于服务器每次启动存储文件的加载顺序会改变,所以推荐读者使用本文DM_UUID的方式进行绑定,绑定关系更稳定;
Note: Replace <DM_UUID> with the one you got it from the step 1 command output.
# vi /etc/udev/rules.d/96-asmmultipath.rules
Add above udev rule
Now save & exit
Step 4: To add or load Udev rules using the below commands.
# /sbin/udevadm control --reload-rules
# /sbin/udevadm trigger --type=devices --action=change
Step 5: Check file permissions on the disk paths.
# ls -l /dev/udev-asmdisk1
# ls -l /dev/mapper/mpathn
# ls -l /dev/dm-x
Note: Here dm-x can be anything like dm-0 or dm-1 or dm-2, so it's based upon your environment
Step 6: Login as a grid user and check disk information using the sg_inq command. You should be able to see disk information using the below sg_inq commands.
# su - grid
$ sg_inq /dev/mapper/mpathn
$ sg_inq /dev/dm-x
Step 7: Now you can proceed further with the RAC setup.
至此,使用udev配置裸设备步骤结束。
十三、安装集群软件并打集群软件补丁
Copy GI软件到grid_home目录
解压最新版opatch到grid目录,在自己的本子上使用moba或者xmanager,
比如我当前操作的台式机ip为:192.168.0.119
[gird@ethanDB-rac1 database]$export DISPLAY=192.168.0.119:0.0
[grid@ethanDB-rac1 database]$./gridSetup.sh -applyPSU /oracle/ru/28828733/
注意:
从12.2开始,Oracle Grid Infrastructure的安装方式发生了较大的变化。在12.2之前,解压Grid的压缩文件我们会得到:
stage
ssh
setup
rpm
response
install5个目录,以及如下3个文件
welcome.html
runInstaller
runcluvfy.sh
执行runInstaller安装就可以了。而到了12.2,解压Grid的压缩安装文件后,我们会得到一长串的目录和文件。非常熟悉的runInstaller没有了,取而代之的是gridSetup.sh
至此,GI infrastructure 安装成功。
十四、安装ORACLE 软件
Oracle软件安装
[oracle@ethanDB-rac1 database]$ ./runInstaller
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 500 MB. Actual 43660 MB Passed
Checking swap space: must be greater than 150 MB. Actual 8191 MB Passed
Checking monitor: must be configured to display at least 256 colors. Actual 16777216 Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2019-08-08_03-44-40PM. Please wait ...
Oracle软件打补丁
下载最新的OPatch至 $ORACLE_HOME
[oracle@ethanDB-rac1 database] unzip p6880880_122010_Linux-x86-64.zip -d $ORACLE_HOME
root 用户:两个节点分别执行:
[root@ethanDB-rac1 database] /oracle/app/oracle/product/12.2.1/dbhome_1/OPatch/opatchauto apply /oracle/ru/28828733 -oh /oracle/app/oracle/product/12.2.1/dbhome_1
Oracle实例创建
[oracle@ethanDB-rac1 database] netca
[oracle@ethanDB-rac1 database] dbca
具体安装省略。。。
至此,整个RAC集群过程搭建结束。
【总结】
1. 本文将讲述RHEL7.2环境下双节点12c RAC搭建实操,具有生产环境借鉴性;
2. 文章重点和之前的11g rac部署最大的不同是本文udev的配置,读者可详细看下;11g中绑定是dm-*,但鉴于服务器每次启动存储文件的加载顺序会改变,所以推荐读者使用本文DM_UUID的方式进行绑定,绑定关系更稳定;
3. 大家要升级Oracle版本,从Oracle可提供的服务生命周期一项考虑,建议使用12.2或者直接19c,后续省心省力;
4. 12c/18c/19c的安装部署类似,本文的12c安装使用的是NON-CDB 非多租户形式,Oracle实例创建阶段的CDB和NON-CDB模式,并不影响本文的配置,读者在多租户配置阶段可根据自身需求进行安装instance。
文末,放一首好歌。
如果大家觉得此文有帮助,欢迎关注个人微信公众号;
长按识别二维码或公众号搜索“一森咖记”