一、 规划
二、 思路清晰
step1: 配置 rac3 操作系统,保持与现有节点一致
step2: 配置 grid 和 oracle 用户互信
step3: 检测集群状态和新节点配置
step4: 执行添加节点脚本
step5: 扩展 DB HOME
step6: 扩展实例
step7: 完成检查
三、 准备工作
1. 关闭防火墙和selinux ( rac3 )
# systemctl stop firewall
# systemctl disable firewall
关闭selinux
# vi /etc/selinux/config
SELINUX=disabled
2. 修改/etc/hosts 文件( rac1/rac2/rac3 )
添加 rac3 的信息
172.16.70.170 rac1
172.16.70.171 rac2
172.16.70.190 rac3
10.0.0.100 rac1-priv
10.0.0.101 rac2-priv
10.0.0.102 rac3-priv
172.16.70.173 rac1-vip
172.16.70.174 rac2-vip
172.16.70.191 rac3-vip
172.16.70.175 cluster-scan-ip
3. 修改内核参数(rac3 )
# vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 8589934591
kernel.shmmni = 4096
kernel.shmall = 2097152
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
4. 修改用户限制(rac3 )
# vi /etc/security/limits.conf
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
5. 添加用户和组(rac3 )
( 1 )创建组
# groupadd -g 501 dba
# groupadd -g 50 2 oinstall
( 2 )创建用户
# useradd -u 50 1 -g oinstall -G dba -d /home/oracle oracle
# useradd -u 600 -g oinstall -G dba -d /home/grid grid ( 3 ) 给oracle 和 grid 用户设置密码
# passwd oracle
# passwd grid
(4 )检查
# id oracle
# id grid
6. 创建目录(rac3 )
# mkdir -p /u01/app/oracle
# mkdir -p /u01/app/oracle /product/11.2.0/db_1
# mkdir -p /u01/app/grid
# mkdir -p /u01/app/11.2.0/grid
# chown -R oracle:oinstall /u01
# chown -R grid:oinstall /u01 /app/grid
# chown -R grid:oinstall /u01/app/11.2.0 /grid
# chown -R oracle:oinstall /u01/app/oracle
# chmod -R 775 /u01
7. 修改环境变量(rac3 )
(grid 用户) $ vi .bash_profile
export ORACLE_SID= +ASM 3
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
(oracle 用户)
$ vi /home/oracle/.bash_profile
export ORACLE_SID= ORCL3
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin
8. 配置本地yum 源,安装软件包( rac3 )
上传iso 镜像到 /u01/set/os 目录
# mount -o loop /u01/setup/os/ rhel-server-7.2-x86_64-dvd.iso /mnt
# vi /etc/yum.repos.d/mnt.repo
[mnt]
name=Yum Source
baseurl=file:///mnt
enabled=1
gpgcheck=0
# yum makecache
安装 如下包:
# yum install -y binutils compat* elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio libgcc libstdc++ libstdc++-devel make sysstat unixODBC-devel libaio-devel ksh
9. 配置ASM 磁盘( rac3 )
# vi /etc/udev/rules.d/ 99-oracle-asmdevices.rules
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT==" 14f504e46494c45524932494157712d763771782d30694f30 ", RUN+="/bin/sh -c 'mknod /dev/asm_ocr b $major $minor; chown grid:oinstall /dev/asm_ocr ; chmod 0660 /dev/asm_ocr '"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT==" 14f504e46494c45526d70325177442d616f33572d35686452 ", RUN+="/bin/sh -c 'mknod /dev/asm_data1 b $major $minor; chown grid:oinstall /dev/asm_data1 ; chmod 0660 /dev/asm_data1 '"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT==" 14f504e46494c455251726b30676d2d337842312d55375278 ", RUN+="/bin/sh -c 'mknod /dev/asm_data2 b $major $minor; chown grid:oinstall /dev/asm_data2 ; chmod 0660 /dev/asm_data2 '"
KERNEL=="sd*[!0-9]", ENV{DEVTYPE}=="disk", SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id -g -u -d $devnode", RESULT==" 14f504e46494c45527650634d78742d4a7664622d3276506e ", RUN+="/bin/sh -c 'mknod /dev/asm_arch b $major $minor; chown grid:oinstall /dev/asm_arch ; chmod 0660 /dev/asm_arch '"
启动udev
# /sbin/udevadm trigger --type=devices --action=change
查看asm 磁盘
# ll /dev/asm*
brw-rw----. 1 grid oinstall 8, 64 Aug 6 10:54 /dev/asm_arch
brw-rw----. 1 grid oinstall 8, 32 Aug 6 10:54 /dev/asm_data1
brw-rw----. 1 grid oinstall 8, 48 Aug 6 10:54 /dev/asm_data2
brw-rw----. 1 grid oinstall 8, 16 Aug 6 10:54 /dev/asm_ocr
注:上面的1-9 步骤需要和 rac1&rac2 配置保持一致
四、 添加节点
1. 配置Oracle 和 grid 用户的互信( rac1 )
(oracle 用户)
$ $ ORACLE_HOME/oui/bin/runSSHSetup.sh -user oracle -hosts 'rac1 rac2 rac3' -advanced -exverify
(grid 用户)
$ $ORACLE_HOME/oui/bin/runSSHSetup.sh -user grid -hosts 'rac1 rac2 rac3' -advanced -exverify
2. 检测集群和新加节点(rac1 )
(grid 用户)
1) 检测rac3 的连通性及共享存储访问
$ cluvfy stage -post hwos -n rac3 -verbose
2) 比较节点2 和节点 3 属性
$ cluvfy comp peer -refnode rac2 -n rac3 -verbose
3) 检测集群和新加节点完整性
$ cluvfy stage -pre nodeadd -n rac3 -fixup -verbose
3. 执行添加节点(rac1 )
$ export IGNORE_PREADDNODE_CHECKS=Y
$ cd $ORACLE_HOME/oui/bin
$ ./addNode.sh -silent "CLUSTER_NEW_NODES={rac3}" "CLUSTER_NEW_VIRTUAL_HOSTNAMES={rac3-vip}"
最后需要在节点3 下, root 用户执行以下两个脚本
# /u01/app/oraInventory/orainstRoot.sh
# /u01/app/11.2.0/grid/root.sh
4. 扩展DB HOME ( rac1 执行)
(oracle 用户)
$ export IGNORE_PREADDNODE_CHECKS=Y
$ cd $ORACLE_HOME/oui/bin
$ ./addNode.sh -silent "CLUSTER_NEW_NODES={rac3}"
最后需要root 用户在 rac3 执行以下脚本:
# /u01/app/oracle/product/11.2.0/db_1/root.sh
5. 扩展实例 (rac1 执行)
(oracle 用户)
方式一:静默方式
执行以下命令:
$ dbca -silent -addInstance -nodeList rac3 -gdbName ORCL -instanceName ORCL3 -sysDBAUserName sys -sysDBAPassword oracle
命令参考:
$ dbca -silent -addInstance -nodeList node_name -gdbName gdb_name -instanceName instance_name -sysDBAUserName sysdba -sysDBAPassword password
参数说明:
node_name: 想要添加到的节点名
gdb_name: global database name
instance_name: 指定实例名
sysdba: 有 sysdba 权限的用户
password: 密码
方式二:DBCA 图形界面方式
6. 资源检查
1) 检查集群资源
$ crsctl status res -t
2) 实例检查
SQL > select instance_number,instance_name,host_name from gv$instance;
INSTANCE_NUMBER INSTANCE_NAME HOST_NAME
--------------- ---------------- ----------
3 ORCL3 rac3
2 ORCL2 rac2
1 ORCL1 rac1
3) 日志检查
检查所有节点 asm alert 日志、 db alert 日志 。
---- end ----