目标:

修改数据库一个节点的vip


1、操作系统版本信息

[root@ggjjzhzzdb01 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)

2、查看/etc/hosts信息

[grid@ggjjzhzzdb02 ~]$ cat /etc/hosts
127.0.0.1  localhost localhost.localdomain localhost4 localhost4.localdomain4
::1        localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.19.7 ggjjzhzzdb01
192.168.19.9 ggjjzhzzdb02


192.168.19.6 ggjjzhzzdb01-vip
192.168.19.10 ggjjzhzzdb02-vip

192.168.1.19  ggjjzhzzdb01-pri
192.168.1.20  ggjjzhzzdb02-pri

192.168.19.11 ggjjzhzzdb-scan

3、使用grid用户查看现在vip配置情况

[grid@ggjjzhzzdb02 ~]$ srvctl config nodeapps  -a
Network exists: 1/192.168.19.0/255.255.255.0/bond0, type static
VIP exists: /ggjjzhzzdb01-vip/192.168.19.6/192.168.19.0/255.255.255.0/bond0, hosting node ggjjzhzzdb01
VIP exists: /ggjjzhzzdb02-vip/192.168.19.10/192.168.19.0/255.255.255.0/bond0, hosting node ggjjzhzzdb02

4、查看vip状态

[grid@ggjjzhzzdb02 ~]$ crs_stat -t | grep vip
ora....b01.vip ora....t1.type ONLINE    ONLINE    ggjj...db01
ora....b02.vip ora....t1.type ONLINE    ONLINE    ggjj...db02
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    ggjj...db01
使用crsctl stat res -t 显示vips的状态为Online
使用ifconfig -a 查看vip逻辑网卡对应物理网卡
[grid@ggjjzhzzdb02 ~]$ ifconfig -a
bond0: flags=5187  mtu 1500
        inet 192.168.19.9  netmask 255.255.255.240  broadcast 192.168.19.15
        inet6 fe80::84b1:7bff:feac:2d83  prefixlen 64  scopeid 0x20
        ether 6c:92:bf:4c:73:35  txqueuelen 0  (Ethernet)
        RX packets 211416  bytes 51979457 (49.5 MiB)
        RX errors 0  dropped 81256  overruns 0  frame 0
        TX packets 24056  bytes 2539918 (2.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

bond0:1: flags=5187  mtu 1500
        inet 192.168.19.10  netmask 255.255.255.240  broadcast 192.168.19.15
        ether 6c:92:bf:4c:73:35  txqueuelen 0  (Ethernet)

bond1: flags=5187  mtu 1500
        inet 192.168.1.20  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a236:9fff:fedc:5c48  prefixlen 64  scopeid 0x20
        ether a0:36:9f:dc:5c:48  txqueuelen 0  (Ethernet)
        RX packets 3267408  bytes 2183229107 (2.0 GiB)
        RX errors 0  dropped 92935  overruns 4298  frame 0
        TX packets 3682761  bytes 3085923418 (2.8 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

开始修改

1、停止nodeapps资源

[grid@ggjjzhzzdb02 ~]$ srvctl stop instance -d ggjjzhzzdb -n ggjjzhzzdb02
[grid@ggjjzhzzdb02 ~]$ srvctl stop vip -n ggjjzhzzdb02 -f

2、验证VIP状态处于OFFLINE状态,并且不再绑定到公共网卡

[grid@ggjjzhzzdb02 ~]$ ifconfig -a
bond0: flags=5187  mtu 1500
        inet 192.168.19.9  netmask 255.255.255.240  broadcast 192.168.19.15
        inet6 fe80::84b1:7bff:feac:2d83  prefixlen 64  scopeid 0x20
        ether 6c:92:bf:4c:73:35  txqueuelen 0  (Ethernet)
        RX packets 212850  bytes 52187517 (49.7 MiB)
        RX errors 0  dropped 81810  overruns 0  frame 0
        TX packets 24301  bytes 2575291 (2.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

bond1: flags=5187  mtu 1500
        inet 192.168.1.20  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a236:9fff:fedc:5c48  prefixlen 64  scopeid 0x20
        ether a0:36:9f:dc:5c:48  txqueuelen 0  (Ethernet)
        RX packets 3285480  bytes 2195451678 (2.0 GiB)
        RX errors 0  dropped 93557  overruns 4298  frame 0
        TX packets 3704086  bytes 3104892925 (2.8 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

3、修改/etc/hosts相关信息

[root@ggjjzhzzdb02 ~]# vi /etc/hosts
127.0.0.1  localhost localhost.localdomain localhost4 localhost4.localdomain4
::1        localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.19.7 ggjjzhzzdb01
192.168.19.9 ggjjzhzzdb02


192.168.19.6 ggjjzhzzdb01-vip
192.168.19.12 ggjjzhzzdb02-vip

192.168.1.19  ggjjzhzzdb01-pri
192.168.1.20  ggjjzhzzdb02-pri

192.168.19.11 ggjjzhzzdb-scan

4、用户root用户修改vip

srvctl modify nodeapps -n ggjjzhzzdb02 -A ggjjzhzzdb02-vip/255.255.255.0/bond0
验证修改成功
[grid@ggjjzhzzdb02 ~]$ srvctl config nodeapps -a
Network exists: 1/192.168.19.0/255.255.255.0/bond0, type static
VIP exists: /ggjjzhzzdb01-vip/192.168.19.6/192.168.19.0/255.255.255.0/bond0, hosting node ggjjzhzzdb01
VIP exists: /ggjjzhzzdb02-vip/192.168.19.12/192.168.19.0/255.255.255.0/bond0, hosting node ggjjzhzzdb02
启动nodeapp及其他状态
[grid@ggjjzhzzdb02 ~]$ srvctl start vip -n ggjjzhzzdb02
[grid@ggjjzhzzdb02 ~]$ srvctl start listener -n ggjjzhzzdb02
[grid@ggjjzhzzdb02 ~]$ srvctl start instance -d ggjjzhzzdb -i ggjjzhzz2
验证VIP状态为ONLINE并且已经绑定到集群公共网卡
 crsctl stat res -t
[grid@ggjjzhzzdb02 ~]$ ifconfig -a
bond0: flags=5187  mtu 1500
        inet 192.168.19.9  netmask 255.255.255.240  broadcast 192.168.19.15
        inet6 fe80::84b1:7bff:feac:2d83  prefixlen 64  scopeid 0x20
        ether 6c:92:bf:4c:73:35  txqueuelen 0  (Ethernet)
        RX packets 215380  bytes 52532880 (50.0 MiB)
        RX errors 0  dropped 82599  overruns 0  frame 0
        TX packets 25107  bytes 2689898 (2.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

bond0:1: flags=5187  mtu 1500
        inet 192.168.19.12  netmask 255.255.255.240  broadcast 192.168.19.15
        ether 6c:92:bf:4c:73:35  txqueuelen 0  (Ethernet)
如果集群其他节点也需要修改,按照上面步骤进行修改。

备注:
查看instance name 及 node name

SQL> select instance_name,HOST_NAME from gv$instance;

INSTANCE_NAME    HOST_NAME
---------------- ----------------------------------------------------------------
ggjjzhzz2        ggjjzhzzdb02
ggjjzhzz1        ggjjzhzzdb01
12-17 00:22