oracle rac 修改 scan ip
-- 场景 :
-- 在我们升级一个系统或更换了网卡后,为了减少对原机的影响及避免修改大量的客户端,新系统的 ip 又会修改回原 ip.
-- 在这里我们简单演示下如何修改其中的 scan ip
-- 环境信息:
scan ip 如下
192.168.24.111 cluster-scan
-- 目标 scan ip 由 192.168.24.111 调整为 192.168.24.100
-- 这个修改,不需要停集群服务,下面我们开始修改 scan ip
1、修改前检查 scan 状态
[grid@rac01 ~]$ srvctl status scan -v
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node rac01
-- 查看当前 scan ip 信息
grid@rac01 ~]$ srvctl config scan
SCAN name: cluster-scan, Network: 1/192.168.24.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /cluster-scan/192.168.24.111
2、停止 scan 服务(如果数据库及监听未关闭,建议先关闭,也可以使用强制停止选项,我们这里选择强制停止scan)
[grid@rac01 ~]$ srvctl stop scan -f
3、所有节点修改 scan ip 的解析 ,我们这里使用的是 hosts 文件解析,修改hosts文件scan ip 为新ip
vim /etc/hosts
...
192.168.24.111 cluster-scan --> 192.168.24.100 cluster-scan
...
4、开始修改 scan(这里需要root用户才能修改)
[grid@rac01 ~]$ srvctl modify scan -n cluster-scan
PRCS-1034 : Failed to modify Single Client Access Name cluster-scan
PRCR-1071 : Failed to register or update resource type ora.scan_vip.type
CRS-0245: User doesn‘t have enough privilege to perform the operation
[grid@rac01 ~]$ exit
[root@rac01 ~]# /u01/app/11.2.0/grid/bin/srvctl modify scan -n cluster-scan
[root@rac01 ~]#
5、让 listener 与 scan ip 同步
[root@rac01 ~]# /u01/app/11.2.0/grid/bin/srvctl modify scan_listener -u
6、确认修改是否成功
[root@rac01 ~]# /u01/app/11.2.0/grid/bin/srvctl config scan
SCAN name: cluster-scan, Network: 1/192.168.24.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /cluster-scan/192.168.24.100
7、启动scan服务
[root@rac01 ~]# /u01/app/11.2.0/grid/bin/srvctl start scan
[root@rac01 ~]# /u01/app/11.2.0/grid/bin/srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node rac01
8、查看scan资源状态
[root@rac01 ~]# /u01/app/11.2.0/grid/bin/crsctl stat res -t |grep -A 1 -i scan
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac01
--
ora.scan1.vip
1 ONLINE ONLINE rac01
9、最后测试下IP是否生效
-- 查看ip(部分内容省略)
[root@rac01 ~]# ip a show eth0
...
link/ether 00:50:56:2B:12:E9 brd ff:ff:ff:ff:ff:ff
inet 192.168.24.95/24 brd 192.168.24.255 scope global eth0
inet 192.168.24.96/24 brd 192.168.24.255 scope global secondary eth0:1
inet 192.168.24.100/24 brd 192.168.24.255 scope global secondary eth0:2
...
--测试是否能ping
[root@rac01 ~]# ping 192.168.24.100
PING 192.168.24.100 (192.168.24.100) 56(84) bytes of data.
64 bytes from 192.0.2.100: icmp_seq=1 ttl=64 time=0.009 ms
64 bytes from 192.0.2.100: icmp_seq=2 ttl=64 time=0.022 ms
-- 到此 scan ip 就修改完成。