目录
当前环境
Oracle环境:Oracle 10.2.0.5 RAC
VIP地址为:172.31.0.75
,172.31.0.76
priave IP:172.31.0.77
,172.31.0.78
通过ifconfig -a
可以看到:
172.31.0.78
对应VIP地址:172.31.0.76
172.31.0.77
对应VIP地址:172.31.0.75
1.通过[srvctl config]确认当前VIP地址.
[oracle@arprac02 ~]$ srvctl config nodeapps -n arprac01 -a
VIP exists.: /arprac01-vip/172.31.0.75/255.255.255.0/eth0
[oracle@arprac02 ~]$ srvctl config nodeapps -n arprac02 -a
VIP exists.: /arprac02-vip/172.31.0.76/255.255.255.0/eth0
上述可以看到:172.31.0.75
是节点1的VIP,172.31.0.76
是节点2的VIP.
2.关闭dbconsole[对应的em]
有的RAC没有装,可选操作
$ emctl stop dbconsole (每个节点停止dbconsole)
3.关闭数据库实例
$ srvctl stop database -d servdb
$ srvctl stop database -d managedb
$ srvctl stop database -d irc3db
4.关闭asm实例
$ srvctl stop asm -n arprac01
$ srvctl stop asm -n arprac02
5.关闭结点服务
$ srvctl stop nodeapps -n arprac01 (停节点1服务)
$ srvctl stop nodeapps -n arprac02 (停节点2服务)
上述操作,可以发现172.31.0.75/76已经没有绑定在网卡上面了。
查看集群命令,发现RAC关闭。
[oracle@arprac01 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application OFFLINE OFFLINE
ora....01.lsnr application OFFLINE OFFLINE
ora....c01.gsd application OFFLINE OFFLINE
ora....c01.ons application OFFLINE OFFLINE
ora....c01.vip application OFFLINE OFFLINE
ora....SM2.asm application OFFLINE OFFLINE
ora....02.lsnr application OFFLINE OFFLINE
ora....c02.gsd application OFFLINE OFFLINE
ora....c02.ons application OFFLINE OFFLINE
ora....c02.vip application OFFLINE OFFLINE
ora.irc3db.db application OFFLINE OFFLINE
ora....b1.inst application OFFLINE OFFLINE
ora....b2.inst application OFFLINE OFFLINE
ora....gedb.db application OFFLINE OFFLINE
ora....b1.inst application OFFLINE OFFLINE
ora....b2.inst application OFFLINE OFFLINE
ora.servdb.db application OFFLINE OFFLINE
ora....b1.inst application OFFLINE OFFLINE
ora....b2.inst application OFFLINE OFFLINE
6.修改两个节点的/etc/hosts文件。
主要修改【arprac01-vip】和【arprac01-vip】
[root@arprac01 ~]# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
172.31.0.95 arprac01-vip
172.31.0.96 arprac02-vip
7.srvctl修改VIP
[root@arprac01 ~]# cd /u01/app/oracle/product/10.2.0/db_1/bin/
[root@arprac01 ~]# export ORACLE_BASE=/u01/app/oracle
[root@arprac01 ~]# export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
#./srvctl modify nodeapps -n arprac01 -A 172.31.0.95/255.255.255.0/eth0
#./srvctl modify nodeapps -n arprac02 -A 172.31.0.96/255.255.255.0/eth0
8.启动ASM
$ srvctl start asm -n arprac01
$ srvctl start asm -n arprac02
9.启动nodeapps
$ srvctl start nodeapps -n arprac01
$ srvctl start nodeapps -n arprac02
10.启动数据库实例
$ srvctl start database -d servdb
11.若local_listener参数HOST使用IP,修改local_listener参数
在RAC1上执行下面语句
SQL> alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=172.31.0.95)(PORT=1521))';
在RAC2上执行下面语句
SQL> alter system set local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST=172.31.0.96)(PORT=1521))';
最后,可以再次查看集群消息:
[oracle@arprac01 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE arprac01
ora....01.lsnr application ONLINE ONLINE arprac01
ora....c01.gsd application ONLINE ONLINE arprac01
ora....c01.ons application ONLINE ONLINE arprac01
ora....c01.vip application ONLINE ONLINE arprac01
ora....SM2.asm application ONLINE ONLINE arprac02
ora....02.lsnr application ONLINE ONLINE arprac02
ora....c02.gsd application ONLINE ONLINE arprac02
ora....c02.ons application ONLINE ONLINE arprac02
ora....c02.vip application ONLINE ONLINE arprac02
ora.irc3db.db application OFFLINE OFFLINE
ora....b1.inst application OFFLINE OFFLINE
ora....b2.inst application OFFLINE OFFLINE
ora....gedb.db application OFFLINE OFFLINE
ora....b1.inst application OFFLINE OFFLINE
ora....b2.inst application OFFLINE OFFLINE
ora.servdb.db application ONLINE ONLINE arprac01
ora....b1.inst application ONLINE ONLINE arprac01
ora....b2.inst application ONLINE ONLINE arprac02
也能看到,虚拟网卡确实是172.31.0.95了。如下:
oracle@arprac01 ~]$ ifconfig -a
eth0 Link encap:Ethernet HWaddr 6C:3B:E5:A5:8D:04
inet addr:172.31.0.77 Bcast:172.31.0.255 Mask:255.255.255.0
inet6 addr: fe80::6e3b:e5ff:fea5:8d04/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1574130270 errors:0 dropped:0 overruns:0 frame:0
TX packets:205160002 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:191736588245 (178.5 GiB) TX bytes:93077811782 (86.6 GiB)
Interrupt:170 Memory:d0a00000-d0a10000
eth0:1 Link encap:Ethernet HWaddr 6C:3B:E5:A5:8D:04
inet addr:172.31.0.95 Bcast:172.31.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:170 Memory:d0a00000-d0a10000