1.使用场景 :
很多时候,我们在升级一个旧系统时,比如由低版本升级上来,为了减少对原机的影响,或者方便回退,可能不是直接在原机上操作,而是新建一台机器来完成。
那么,正式切换后,我们为了避免修改大量的客户端,新系统的 ip 又会修改回 原 ip.
做为 rac,我们只需要修改 scan ip为 原 ip 即可。
2.环境信息:
192.0.2.101 host01.example.com host01
192.0.2.102 host02.example.com host02
192.168.133.101 host01-priv.example.com host01-priv
192.168.133.102 host02-priv.example.com host02-priv
192.168.132.101 host01-priv.example.com host01-priv
192.168.132.102 host02-priv.example.com host02-priv
192.0.2.103 host01-vip.example.com host01-vip
192.0.2.104 host02-vip.example.com host02-vip
192.0.2.105 cluster01-scan.example.com cluster01-scan
3.目标
scan ip 由 192.0.2.105 调整为 192.0.2.100
4.步骤
这个修改,不用停 集群服务
4.1 修改前检查状态
[oracle@host01 ~]$ srvctl status scan -v
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node host01
4.2 查看当前 scan ip 信息
oracle@host01 ~]$ srvctl config scan
SCAN name: cluster01-scan.example.com, Network: 1/192.0.2.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /cluster01-scan.example.com/192.0.2.105
4.3 强制停 scan
上面有数据库,监听等,建议先停止,也可以使用 强制停止选项,我们这里选择强制
[oracle@host01 ~]$ srvctl stop scan -f
4.4 所有节点 修改 scan ip 的解析 ,我们使用 hosts文件
vim /etc/hosts
...
192.0.2.105 cluster01-scan.example.com cluster01-scan
...
修改为
vim /etc/hosts
...
192.0.2.100 cluster01-scan.example.com cluster01-scan
...
4.5 修改 scan,注意,这里需要root用户才能修改,否则,会报错
[oracle@host01 ~]$ srvctl modify scan -n cluster01-scan.example.com
PRCS-1034 : Failed to modify Single Client Access Name cluster01-scan.example.com
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
[oracle@host01 ~]$ exit
[root@host01 ~]# /u01/app/11.2.0/grid/bin/srvctl modify scan -n cluster01-scan.example.com
[root@host01 ~]#
--让listener 与 scanip 同步
[root@host01 ~]# /u01/app/11.2.0/grid/bin/srvctl modify scan_listener -u
4.6 确认 修改
[root@host01 ~]# /u01/app/11.2.0/grid/bin/srvctl config scan
SCAN name: cluster01-scan.example.com, Network: 1/192.0.2.0/255.255.255.0/eth0
SCAN VIP name: scan1, IP: /cluster01-scan.example.com/192.0.2.100
4.7 启动scan
[root@host01 ~]# /u01/app/11.2.0/grid/bin/srvctl start scan
[root@host01 ~]# /u01/app/11.2.0/grid/bin/srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node host01
--查看资源状态
[root@host01 ~]# /u01/app/11.2.0/grid/bin/crsctl stat res -t |grep -A 1 -i scan
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE host01
--
ora.scan1.vip
1 ONLINE ONLINE host01
4.8 测试新网络生效
--查看ip
[root@host01 ~]# ip a show eth0
...
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:0c:29:96:9e:4f brd ff:ff:ff:ff:ff:ff
inet 192.0.2.101/24 brd 192.0.2.255 scope global eth0
inet 192.0.2.103/24 brd 192.0.2.255 scope global secondary eth0:1
inet 192.0.2.100/24 brd 192.0.2.255 scope global secondary eth0:2
...
--测试是否能ping
[root@host01 ~]# ping 192.0.2.100
PING 192.0.2.100 (192.0.2.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
|