在三个节点,配置hosts文件,新增节点和原有节点都配置为相同的
12.16.10.5 rac1
12.16.10.6 rac2
12.16.10.4 rac3
12.16.10.7 rac1-vip
12.16.10.8 rac2-vip
12.16.10.5 rac3-vip
12.16.12.5 rac1-priv
12.16.12.6 rac2-priv
12.16.12.4 rac3-priv
12.16.10.9 scan
查到1节点和2节点的uid和gid (在对应用户下输入id敲回车就能查看或者是id <username>)
uid=1200(oracle) gid=1000(oinstall)groups=1000(oinstall),1200(dba),1201(oper),1300(asmdba)
uid=1100(grid)
gid=1000(oinstall)groups=1000(oinstall),1100(asmadmin),1300(asmdba),1301(asmoper)
/usr/sbin/groupadd -g 1000 oinstall
/usr/sbin/groupadd -g 1100 asmadmin
/usr/sbin/groupadd -g 1200 dba
/usr/sbin/groupadd -g 1201 oper
/usr/sbin/groupadd -g 1300 asmdba
/usr/sbin/groupadd -g 1301 asmoper
useradd -u 1100 -g oinstall -Gasmadmin,asmdba,asmoper grid
useradd -u 1200 -g oinstall -Gdba,oper,asmdba oracle
修改grid、oracle 用户密码
#如果发现user的uid不一样 使用usermod -u<uid><user>
使添加的节点能够访问共享存储
配置grid及oracle的ORACLE_BASE和ORACLE_HOME目录和权限(查看现有rac节点两个用户的ORACLE_BASE和ORACLE_HOME目录,并建立相应的文件夹)
创建grid目录
mkdir -p /u01/app/11.2.0/grid
chown grid:oinstall /u01/ -R
chmod 775 /u01/ -R
创建oracle目录
mkdir -p /u02/app/oracle/product/11.2.0/dbhome_1
chown oracle:oinstall /u02/ -R
chmod 775 /u02/ -R
和安装rac时一样,配置操作系统参数(参考1节点和2节点)
vi /etc/security/limits.conf
vi /etc/sysctl.conf
vi /etc/pam.d/login
去除时间同步选项
chkconfig ntpd off
service ntpd stop
mv /etc/ntp.conf /etc/ntp.conf.bak
修改grid和oracle的环境变量
配置互信关系
首先在grid,oracle用户下生成publickey
su - grid
[[email protected] ~]$ /usr/bin/ssh-keygen -t rsa
[[email protected] ~]$ cd .ssh/
[[email protected] .ssh]$ ls
id_rsa id_rsa.pub
su - oracle
[[email protected] ~]$ /usr/bin/ssh-keygen -t rsa
[[email protected] ~]$ cd .ssh/
[[email protected] .ssh]$ ll
-rw------- 1 oracle oinstall 1675 Mar 2521:40 id_rsa
-rw-r--r-- 1 oracle oinstall 404 Mar 25 21:40 id_rsa.pub
grid用户的SSH(11grac2<--->,11grac1<--->rac3两两配置即可)
[[email protected] .ssh]$ scp id_rsa.pubrac3:/home/grid/.ssh/id_rsa1.pub
[[email protected] .ssh]$ scp id_rsa.pub11grac1:/home/grid/.ssh/id_rsa2.pub
[[email protected] .ssh]$ cat *.pub>>authorized_keys
[[email protected] .ssh]$ cat *.pub>>authorized_keys
[[email protected] .ssh]$ scp id_rsa.pubrac3:/home/grid/.ssh/id_rsa2.pub
[[email protected] .ssh]$ scp id_rsa.pub11grac2:/home/grid/.ssh/id_rsa1.pub
[[email protected] .ssh]$ cat *.pub>>authorized_keys
[[email protected] .ssh]$ cat *.pub>>authorized_keys
oracle用户的配置也是一样的。不再赘述。
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
其实Oracle11g已经帮我提供了自动化的脚本sshUserSetup.sh
/g01/11201_install/grid/sshsetup (grid软件包解压之后的目录)
[[email protected] sshsetup]# ls
sshUserSetup.sh
[[email protected] sshsetup]$ pwd
/u01/11201_install/database/sshsetup(oracle软件包解压之后的目录)
[[email protected] sshsetup]$ ls
sshUserSetup.sh
执行如下命令即可。
./sshUserSetup.sh -user grid -hosts"rac1 rac2 rac3" -advanced -noPromptPassphrase
./sshUserSetup.sh -user oracle -hosts"rac1 rac2 rac3" -advanced -noPromptPassphrase
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
老节点oracle及grid用户下检查:
cluvfy stage -pre nodeadd -n rac3 –verbose
在节点1上执行添加操作
以grid用户进入到ORACLE_HOME下的oui/bin目录执行如下命令:
export IGNORE_PREADDNODE_CHECKS=Y
./addNode.sh -silent"CLUSTER_NEW_NODES={rac3}" “CLUSTER_NEW_VIRTUAL_HOSTNAMES={rac3-vip}”
在rac3上用root用户执行脚本:
/u01/app/oraInventory/orainstRoot.sh
/u01/app/11.2.0/grid/root.sh
如果执行/u01/app/11.2.0/grid/root.sh不成功可执行下面这条删除配置,找到原因后重新执行root.sh脚本
[[email protected] ~]#/u01/app/11.2.0/grid/crs/install/roothas.pl -deconfig –force
遇到下面的错
解决方法:
cd /lib64
[[email protected] lib64]# ls -lrt libcap
libcap-ng.so.0 libcap-ng.so.0.0.0 libcap.so.2 libcap.so.2.16
[[email protected] lib64]# ls -lrt libcap.so.2
lrwxrwxrwx. 1 root root 14 12月 23 21:21libcap.so.2 -> libcap.so.2.16
[[email protected] lib64]# ln -s libcap.so.2.16libcap.so.1
重新执行即可
添加数据库软件:
在节点1上以oracle用户执行如下命令:
[[email protected] sshsetup]# su – oracle
[[email protected] ~]$ cd $ORACLE_HOME/oui/bin
./addNode.sh -silent"CLUSTER_NEW_NODES={rac3}"
/u02/app/oracle/product/11.2.0/dbhome_1/root.sh#On nodes rac3
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run thescripts in each cluster node
添加数据库实例
在节点1上运行dbca命令,图形化界面添加instance
sys/oracle
如果此步骤中点击下一步出现service name or instance name is not specified 错误提示,请先以grid用户运行netca建立监听可,问题可解决
添加节点后确认信息
1,[[email protected] ~]$crsctl stat res –t
2,[[email protected] ~]$ cd$ORACLE_HOME /OPatch/
[[email protected]]$ ./opatch lsinventory
3,[[email protected] ~]$ olsnodes–s
[[email protected]~]$ olsnodes –n
用户等效性
[[email protected] ~]$ cluvfy comp admprv -odb_config -d /u02/app/oracle/product/11.2.0/dbhome_1 -n rac3 –verbose
检查集群的完整性
[[email protected] ~]$ cluvfy stage -post nodeadd-n rac3 –verbose