一、修改root用户环境变量
[root@RAC1 ~]# vi .bash_profile
添加如下语句
JAVA_HOME=/usr/local/java
export JAVA_HOME
ORACLE_BASE=/u01/app/grid
export ORACLE_BASE
ORACLE_HOME=/u01/app/11.2.0/grid
export ORACLE_HOME
ORACLE_PATH=/u01/app/oracle/common/oracle/sql
export ORACLE_PATH
ORACLE_TERM=xterm
export ORACLE_TERM
NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"
export NLS_DATE_FORMAT
TNS_ADMIN=$ORACLE_HOME/network/admin
export TNS_ADMIN
PATH=.:${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
THREADS_FLAG=native
export THERADS_FLAG
export TEMP=/tmp
export TMPDIR=/tmp
运行
[root@RAC1 ~]# source .bash_profile
使修改生效
二、原RAC信息
[root@RAC1 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#eth0 - Public IP
10.5.10.2 rac1
10.5.10.3 rac2
#eth1 - Private IP
8.8.8.1 rac1-priv
8.8.8.2 rac2-priv
#VIP
10.5.10.4 rac1-vip
10.5.10.5 rac2-vip
#SCAN
10.5.10.6 rac-cluster-scan
目前两个节点的eth0 对应Public IP,eth1 对应Private IP,目标是eth0 与eht1 绑定bond0对应Public IP,eth3 与eth4 绑定bond1对应Private IP,具体IP地址不变。
三、修改RAC配置
一旦修改网卡绑定之后,RAC就不能启动,也就不能进行修改,所以我们这里先修改PUBLIC和 Private配置。修改完之后再绑定双网卡。
当前Public和 Private信息
[root@RAC1 ~]# cd /u01/app/11.2.0/grid/bin/
[root@RAC1 bin]# oifcfg getif -global
eth0 10.5.10.0 global public
eth1 8.0.0.0 global cluster_interconnect
[root@RAC1 bin]# srvctl config nodeapps
网络存在: 1/10.5.10.0/255.255.255.0/eth0, 类型 static
VIP 存在: /10.5.10.4/10.5.10.4/10.5.10.0/255.255.255.0/eth0, 托管节点 rac1
VIP 存在: /10.5.10.5/10.5.10.5/10.5.10.0/255.255.255.0/eth0, 托管节点 rac2
GSD 已存在
ONS 存在: 本地端口 6100, 远程端口 6200, EM 端口 2016
[root@RAC1 bin]# srvctl config nodeapps -n rac1 -a
-n 选项已过时。
网络存在: 1/10.5.10.0/255.255.255.0/eth0, 类型 static
VIP 存在: /10.5.10.4/10.5.10.4/10.5.10.0/255.255.255.0/eth0, 托管节点 rac1
[root@RAC1 bin]# srvctl config nodeapps -n rac2 -a
-n 选项已过时。
网络存在: 1/10.5.10.0/255.255.255.0/eth0, 类型 static
VIP 存在: /10.5.10.5/10.5.10.5/10.5.10.0/255.255.255.0/eth0, 托管节点 rac2
修改Public和 Private信息
删除当前配置
[root@RAC1 ~]# cd /u01/app/11.2.0/grid/bin/
[root@RAC1 bin]# oifcfg delif -global eth0
[root@RAC1 bin]# oifcfg delif -global eth1
PRIF-31: Failed to deletethe specified network interface because it is the last private interface
目前无法删除Private 信息,需要先添加再删除
[root@RAC1 bin]# oifcfg setif -global bond0/10.5.10.0:public
[root@RAC1 bin]# oifcfg setif -global bond1/8.0.0.0:cluster_interconnect
[root@RAC1 bin]# oifcfg delif -global eth1
[root@RAC1 bin]# oifcfg getif
bond0 10.5.10.0 global public
bond1 8.0.0.0 global cluster_interconnect
四、双网卡绑定配置
停止RAC
[root@RAC1 bin]# crsctl stop crs
RAC1操作
修改网卡配置文件
创建bond0配置文件
[root@RAC1 bin]# vi /etc/sysconfig/network-scripts/ifcfg-bond0
写入
DEVICE=bond0
BOOTPROTO=none
IPADDR=10.5.10.2
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
GATEWAY=10.5.10.254
USERCTL=no
IPV6INIT=no
PEERDNS=yes
创建bond1配置文件
[root@RAC1 bin]# vi /etc/sysconfig/network-scripts/ifcfg-bond1
写入
DEVICE=bond1
BOOTPROTO=none
IPADDR=8.8.8.1
NETMASK=255.0.0.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
修改eth0
[root@RAC1 bin]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPV6INIT=no
USERCTL=no
PEERDNS=yes
MASTER=bond0
SLAVE=yes
修改eth1
[root@RAC1 bin]# vi /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPV6INIT=no
USERCTL=no
PEERDNS=yes
MASTER=bond0
SLAVE=yes
修改eth2
[root@RAC1 bin]# vi /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPV6INIT=no
USERCTL=no
PEERDNS=yes
MASTER=bond1
SLAVE=yes
修改eth3
[root@RAC1 bin]# vi /etc/sysconfig/network-scripts/ifcfg-eth3
DEVICE=eth3
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPV6INIT=no
USERCTL=no
PEERDNS=yes
MASTER=bond1
SLAVE=yes
配置绑定模型
[root@RAC1 ~]# vi /etc/modprobe.d/dist.conf
添加
alias bond0 bonding
options bond0 miimon=100 mode=0
alias bond1 bonding
options bond1 miimon=100 mode=0
mode 的值表示工作模式,0代表负载,1代表冗余
配置网卡启动顺序
[root@RAC1 ~]# vi /etc/rc.d/rc.local
添加
ifenslave bond0 eth0 eth1
ifenslave bond1 eth2 eth3
关闭NetworkManager 服务
[root@RAC1 ~]# service NetworkManager stop
[root@RAC1 ~]# chkconfig NetworkManager off
重启网络服务
[root@RAC1 ~]# chkconfig NetworkManager off
[root@RAC1 ~]# service network restart
正在关闭接口 bond0: [确定]
正在关闭接口 bond1: [确定]
关闭环回接口: [确定]
弹出环回接口: [确定]
弹出界面 bond0: Determining if ip address 10.5.10.2 is already in use for device bond0...
[确定]
弹出界面 bond1: Determining if ip address 8.8.8.1 is already in use for device bond1...
[确定]
RAC1的网卡绑定操作完成
RAC2操作
RAC2的网卡绑定操作步骤与RAC1相同,注意修改对应的bond0与bond1的IP地址即可。
五、重启RAC1与RAC2
六、修改VIP
[root@RAC1 ~]# cd /u01/app/11.2.0/grid/bin/
[root@RAC1 bin]# srvctl modify nodeapps -n rac1 -A 10.5.10.4/255.255.255.0/bond0
[root@RAC1 bin]# srvctl modify nodeapps -n rac2 -A 10.5.10.5/255.255.255.0/bond0
七、启动RAC
[root@RAC1 bin]# crsctl start crs
CRS-4640: Oracle High Availability Services is already active
CRS-4000: Command Start failed, or completed with errors.
RAC已经启动
[root@RAC1 bin]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.BACKUP.dg ora....up.type ONLINE ONLINE rac2
ora.DATA.dg ora....up.type ONLINE ONLINE rac2
ora....ER.lsnr ora....er.type ONLINE ONLINE rac1
ora....N1.lsnr ora....er.type ONLINE ONLINE rac1
ora.OCR.dg ora....up.type ONLINE ONLINE rac2
ora.asm ora.asm.type ONLINE ONLINE rac2
ora.cvu ora.cvu.type ONLINE ONLINE rac1
ora.db.db ora....se.type ONLINE ONLINE rac2
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE rac1
ora.oc4j ora.oc4j.type ONLINE ONLINE rac1
ora.ons ora.ons.type ONLINE ONLINE rac1
ora....SM1.asm application ONLINE OFFLINE
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip ora....t1.type ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application OFFLINE OFFLINE
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip ora....t1.type ONLINE ONLINE rac2
ora.scan1.vip ora....ip.type ONLINE ONLINE rac1
2016/9/12