在前面的文章中提到过如何修改Oralce RAC的scan ip,在实际工作中,可能会根据客户现场需要修改Oracle RAC的各种Ip地址,比如Public Ip、Private Ip、Vip,在这篇文章中将会介绍如何修改Oracle RAC的vip(Virtual Ip)。案例中以Oracle 11.2.0.4 RAC为例进行操作步骤分解。

1、操作系统及数据库

Os Version:Red Hat Enterprise Linux Server release 6.9 

Database Version:oracle 11.2.0.4

2、/etc/hosts配置

cat /etc/hosts

192.168.77.10 rac1

10.10.10.30 rac1priv

192.168.77.11 rac2

10.10.10.40 rac2priv

192.168.77.12 rac1vip

192.168.77.13 rac2vip

192.168.77.15 racscanip

3、实验需求

将rac1vip 192.168.77.12改为192.168.77.16

将rac2vip 192.168.77.13改为192.168.77.17

4、查看当前vip的状态信息

[grid@rac1 ~]$ srvctl status vip -n rac1

VIP rac1vip is enabled

VIP rac1vip is running on node: rac1

[grid@rac1 ~]$ srvctl status vip -n rac2

VIP rac2vip is enabled

VIP rac2vip is running on node: rac2

[grid@rac1 ~]$ srvctl config vip -n rac1

VIP exists.: rac1

VIP exists.: /rac1vip/192.168.77.12/255.255.255.0/eth0

[grid@rac1 ~]$ srvctl config vip -n rac2

VIP exists.: rac2

VIP exists.: /rac2vip/192.168.77.13/255.255.255.0/eth0

Linux平台Oracle 11G RAC修改Vip_oracle

5、停止两节点的监听及vip资源

[grid@rac1 ~]$ srvctl stop listener -n rac1

[grid@rac1 ~]$ srvctl stop listener -n rac2

[grid@rac1 ~]$ srvctl stop vip -n rac1

[grid@rac1 ~]$ srvctl stop vip -n rac2

[grid@rac1 ~]$ crsctl stat res -t

6、在所有节点/etc/hosts文件中修改新v ip地址

Linux平台Oracle 11G RAC修改Vip_oracle_02

7、修改ocr注册信息,此时查看config配置已经修改完成 (root用户权限)

srvctl modify nodeapps -n rac1 -A 192.168.77.16/255.255.255.0/eth0

srvctl modify nodeapps -n rac2 -A 192.168.77.17/255.255.255.0/eth0

Linux平台Oracle 11G RAC修改Vip_oracle_03

[root@rac1 grid]# srvctl config vip -n rac1

VIP exists.:rac1

VIP exists.: /rac1vip/192.168.77.16/255.255.255.0/eth0

[root@rac1 grid]# srvctl config vip -n rac2

VIP exists.:rac2

VIP exists.: /rac2vip/192.168.77.17/255.255.255.0/eth0

[root@rac1 grid]#

8、启动两节点的监听及vip资源

[root@rac1 grid]# srvctl start vip -n rac1

[root@rac1 grid]# srvctl start vip -n rac2

[root@rac1 grid]# srvctl start listener -n rac1

[root@rac1 grid]# srvctl start listener -n rac2

9、检查修改后vip的详细情况

[root@rac1 grid]# crsctl stat res -t 

10、检查vip配置是否正确

[root@rac1 grid]# srvctl status vip -n rac1

VIP rac1vip is enabled

VIP rac1vip is running on node: rac1

[root@rac1 grid]# srvctl status vip -n rac2

^[[AVIP rac2vip is enabled

VIP rac2vip is running on node: rac2

[root@rac1 grid]# srvctl status vip -n rac2

VIP rac2vip is enabled

VIP rac2vip is running on node: rac2

[root@rac1 grid]# srvctl config vip -n rac1

VIP exists.:rac1

VIP exists.: /rac1vip/192.168.77.16/255.255.255.0/eth0

[root@rac1 grid]# srvctl config vip -n rac2

VIP exists.:rac2

VIP exists.: /rac2vip/192.168.77.17/255.255.255.0/eth0

[root@rac1 grid]#

11、检查vip是否可以ping通及连接

Linux平台Oracle 11G RAC修改Vip_实操_04

12、修改参数LOCAL_LISTENER后,手工注册监听,成功,无需重启任务服务

alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.77.16)(PORT=1521))' sid = 'racdb1';

alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.77.17)(PORT=1521))' sid = 'racdb2';

alter system register;

13、测试连接

Linux平台Oracle 11G RAC修改Vip_干货_05

Linux平台Oracle 11G RAC修改Vip_rac vip_06

最后希望文章能对您的工作带来一定的帮助,喜欢的话可以添加点赞和关注!