Oracle 10G RAC修改VIP地址与手动启动/关闭VIP资源
我们的文章会在微信公众号IT民工的龙马人生和博客网站( www.htz.pw )同步更新 ,欢迎关注收藏,也欢迎大家转载,但是请在文章开始地方标注文章出处,谢谢!
由于博客中有大量代码,通过页面浏览效果更佳。
Oracle 10G RAC修改VIP地址与手动启动/关闭VIP资源
下面是在10.2.0.5版本中,修改VIP地址,关于主机IP地址修改不在此BLOG中。
环境介绍:
欢迎大家加入ORACLE超级群:17115662 免费解决各种ORACLE问题,以后BLOG将迁移到http://www.htz.pw
由于VMWARE中网卡IP地址变化,需要修改共有IP地址。
1,查看当前环境
1.1 资源的状态
[root@htz62 ~]# crs_stat -t
Name Type Target State Host
————————————————————
ora.htz.db application ONLINE ONLINE htz62
ora….z1.inst application ONLINE ONLINE htz62
ora….z2.inst application ONLINE ONLINE htz63
ora….SM1.asm application ONLINE ONLINE htz62
ora….62.lsnr application ONLINE OFFLINE
ora.htz62.gsd application ONLINE ONLINE htz62
ora.htz62.ons application ONLINE ONLINE htz62
ora.htz62.vip application ONLINE ONLINE htz62
ora….SM2.asm application ONLINE ONLINE htz63
ora….63.lsnr application ONLINE OFFLINE
ora.htz63.gsd application ONLINE ONLINE htz63
ora.htz63.ons application ONLINE ONLINE htz63
ora.htz63.vip application ONLINE ONLINE htz63
1.2 查看IP地址信息
[root@htz62 ~]# ifconfig -a|grep addr
eth0 Link encap:Ethernet HWaddr 00:0C:29:84:4F:D4
inet addr:192.168.188.62 Bcast:192.168.188.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe84:4fd4/64 Scope:Link
Base address:0x2400 Memory:c9060000-c9080000
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:84:4F:D4
inet addr:192.168.111.64 Bcast:192.168.111.255 Mask:255.255.255.0
Base address:0x2400 Memory:c9060000-c9080000
eth1 Link encap:Ethernet HWaddr 00:0C:29:84:4F:DE
inet addr:192.168.112.62 Bcast:192.168.112.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe84:4fde/64 Scope:Link
Base address:0x2440 Memory:c9080000-c90a0000
eth2 Link encap:Ethernet HWaddr 00:0C:29:84:4F:E8
inet6 addr: fe80::20c:29ff:fe84:4fe8/64 Scope:Link
Base address:0x2480 Memory:c90c0000-c90e0000
eth3 Link encap:Ethernet HWaddr 00:0C:29:84:4F:F2
inet6 addr: fe80::20c:29ff:fe84:4ff2/64 Scope:Link
Base address:0x24c0 Memory:c90e0000-c9100000
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
1.3 查看网卡配置
[root@htz62 ~]# oifcfg getif
eth0 192.168.111.0 global public
eth1 192.168.112.0 global cluster_interconnect
2,修改信息
2.1 停相关资源
[root@htz62 ~]# srvtl stop database -d htz
[root@htz62 ~]# srvctl stop asm -n htz62
[root@htz62 ~]# srvctl stop asm -n htz63
[root@htz62 ~]# srvctl stop nodeapps -n htz62
[root@htz62 ~]# srvctl stop nodeapps -n htz63
[root@htz62 ~]# crs_stat -t
Name Type Target State Host
————————————————————
ora.htz.db application OFFLINE OFFLINE
ora….z1.inst application OFFLINE OFFLINE
ora….z2.inst application OFFLINE OFFLINE
ora….SM1.asm application OFFLINE OFFLINE
ora….62.lsnr application OFFLINE OFFLINE
ora.htz62.gsd application OFFLINE OFFLINE
ora.htz62.ons application OFFLINE OFFLINE
ora.htz62.vip application OFFLINE OFFLINE
ora….SM2.asm application OFFLINE OFFLINE
ora….63.lsnr application OFFLINE OFFLINE
ora.htz63.gsd application OFFLINE OFFLINE
ora.htz63.ons application OFFLINE OFFLINE
ora.htz63.vip application OFFLINE OFFLINE
2.2修改hosts文件
[root@htz62 ~]# cat /etc/hosts
Do not remove the following line, or various programs
that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.188.62 htz62
192.168.188.63 htz63
192.168.188.64 htz62-vip
192.168.188.65 htz63-vip
192.168.112.62 htz62-priv
192.168.112.63 htz63-priv
2.3 修改oifcfg中信息
[root@htz62 ~]# oifcfg delif -global eth0
[root@htz62 ~]# oifcfg setif -global eth0/192.168.188.0:public
[root@htz62 ~]# oifcfg getif
eth0 192.168.188.0 global public
eth1 192.168.112.0 global cluster_interconnect
2.4 修改监听文件
[root@htz62 admin]# vi listener.ora
listener.ora.htz62 Network Configuration File: /oracle/app/oracle/product/10.2.0/db_1/network/admin/listener.ora.htz62
Generated by Oracle configuration tools.
LISTENER_HTZ62 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = htz62-vip)(PORT = 1521)(IP = FIRST))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.188.62)(PORT = 1521)(IP = FIRST))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
)
)
2.5 修改nodeapps信息
不知道什么原因,这里看到nodeapps信息已经修改了,但是在下面启动的时候还是报错了。
[root@htz62 ~]# srvctl config nodeapps -n htz62 -a
VIP exists.: /htz62-vip/192.168.188.64/255.255.255.0/eth0
[root@htz62 ~]# srvctl config nodeapps -n htz63 -a
VIP exists.: /htz63-vip/192.168.188.65/255.255.255.0/eth0
启动报错
[root@htz62 admin]# srvctl start nodeapps -n htz62
htz62:ora.htz62.LISTENER_HTZ62.lsnr:
htz62:ora.htz62.LISTENER_HTZ62.lsnr:LSNRCTL for Linux: Version 10.2.0.5.0 – Production on 16-JUN-2014 17:34:50
htz62:ora.htz62.LISTENER_HTZ62.lsnr:
htz62:ora.htz62.LISTENER_HTZ62.lsnr:Copyright (c) 1991, 2010, Oracle. All rights reserved.
htz62:ora.htz62.LISTENER_HTZ62.lsnr:
htz62:ora.htz62.LISTENER_HTZ62.lsnr:Starting /oracle/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait…
htz62:ora.htz62.LISTENER_HTZ62.lsnr:
htz62:ora.htz62.LISTENER_HTZ62.lsnr:TNSLSNR for Linux: Version 10.2.0.5.0 – Production
htz62:ora.htz62.LISTENER_HTZ62.lsnr:System parameter file is /oracle/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
htz62:ora.htz62.LISTENER_HTZ62.lsnr:Log messages written to /oracle/app/oracle/product/10.2.0/db_1/network/log/listener_htz62.log
htz62:ora.htz62.LISTENER_HTZ62.lsnr:Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=htz62-vip)(PORT=1521)(IP=FIRST)))
htz62:ora.htz62.LISTENER_HTZ62.lsnr:TNS-12545: Connect failed because target host or object does not exist
htz62:ora.htz62.LISTENER_HTZ62.lsnr: TNS-12560: TNS:protocol adapter error
htz62:ora.htz62.LISTENER_HTZ62.lsnr: TNS-00515: Connect failed because target host or object does not exist
htz62:ora.htz62.LISTENER_HTZ62.lsnr: Linux Error: 99: Cannot assign requested address
htz62:ora.htz62.LISTENER_HTZ62.lsnr:
htz62:ora.htz62.LISTENER_HTZ62.lsnr:Listener failed to start. See the error message(s) above…
htz62:ora.htz62.LISTENER_HTZ62.lsnr:
htz62:ora.htz62.LISTENER_HTZ62.lsnr:
htz62:ora.htz62.LISTENER_HTZ62.lsnr:LSNRCTL for Linux: Version 10.2.0.5.0 – Production on 16-JUN-2014 17:34:53
htz62:ora.htz62.LISTENER_HTZ62.lsnr:
htz62:ora.htz62.LISTENER_HTZ62.lsnr:Copyright (c) 1991, 2010, Oracle. All rights reserved.
htz62:ora.htz62.LISTENER_HTZ62.lsnr:
htz62:ora.htz62.LISTENER_HTZ62.lsnr:Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=htz62-vip)(PORT=1521)(IP=FIRST)))
htz62:ora.htz62.LISTENER_HTZ62.lsnr:TNS-12560: TNS:protocol adapter error
htz62:ora.htz62.LISTENER_HTZ62.lsnr: TNS-00530: Protocol adapter error
htz62:ora.htz62.LISTENER_HTZ62.lsnr: Linux Error: 113: No route to host
htz62:ora.htz62.LISTENER_HTZ62.lsnr:Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.188.62)(PORT=1521)(IP=FIRST)))
htz62:ora.htz62.LISTENER_HTZ62.lsnr:TNS-12541: TNS:no listener
htz62:ora.htz62.LISTENER_HTZ62.lsnr: TNS-12560: TNS:protocol adapter error
htz62:ora.htz62.LISTENER_HTZ62.lsnr: TNS-00511: No listener
htz62:ora.htz62.LISTENER_HTZ62.lsnr: Linux Error: 111: Connection refused
htz62:ora.htz62.LISTENER_HTZ62.lsnr:Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC)))
htz62:ora.htz62.LISTENER_HTZ62.lsnr:TNS-12541: TNS:no listener
htz62:ora.htz62.LISTENER_HTZ62.lsnr: TNS-12560: TNS:protocol adapter error
htz62:ora.htz62.LISTENER_HTZ62.lsnr: TNS-00511: No listener
htz62:ora.htz62.LISTENER_HTZ62.lsnr: Linux Error: 2: No such file or directory
CRS-0215: Could not start resource ‘ora.htz62.LISTENER_HTZ62.lsnr’.
修改nodeapps后一切正常
[root@htz62 admin]# srvctl modify nodeapps -n htz62 -A htz62-vip/255.255.255.0/eth0
[root@htz62 admin]# srvctl modify nodeapps -n htz63 -A htz63-vip/255.255.255.0/eth0
[root@htz62 admin]# srvctl config nodeapps -n htz62 -a
VIP exists.: /htz62-vip/192.168.188.64/255.255.255.0/eth0
3,启动nodeapps资源
[root@htz62 admin]# srvctl start nodeapps -n htz62
[root@htz62 admin]# srvctl start nodeapps -n htz63
[root@htz62 admin]# crs_stat -t
Name Type Target State Host
————————————————————
ora.htz.db application OFFLINE OFFLINE
ora….z1.inst application OFFLINE OFFLINE
ora….z2.inst application OFFLINE OFFLINE
ora….SM1.asm application OFFLINE OFFLINE
ora….62.lsnr application ONLINE ONLINE htz62
ora.htz62.gsd application ONLINE ONLINE htz62
ora.htz62.ons application ONLINE ONLINE htz62
ora.htz62.vip application ONLINE ONLINE htz62
ora….SM2.asm application OFFLINE OFFLINE
ora….63.lsnr application ONLINE ONLINE htz63
ora.htz63.gsd application ONLINE ONLINE htz63
ora.htz63.ons application ONLINE ONLINE htz63
ora.htz63.vip application ONLINE ONLINE htz63
4,测试VIP手动启动与关闭
4.1 手动启动与关闭VIP资源
[root@htz62 admin]# crs_stop -f ora.htz62.vip
Attempting to stop `ora.htz62.LISTENER_HTZ62.lsnr` on member `htz62`
Stop of `ora.htz62.LISTENER_HTZ62.lsnr` on member `htz62` succeeded.
Attempting to stop `ora.htz62.vip` on member `htz62`
Stop of `ora.htz62.vip` on member `htz62` succeeded.
查看IP地址是否还存在
[root@htz62 admin]# ifconfig -a|grep addr
eth0 Link encap:Ethernet HWaddr 00:0C:29:84:4F:D4
inet addr:192.168.188.62 Bcast:192.168.188.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe84:4fd4/64 Scope:Link
Base address:0x2400 Memory:c9060000-c9080000
eth1 Link encap:Ethernet HWaddr 00:0C:29:84:4F:DE
inet addr:192.168.112.62 Bcast:192.168.112.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe84:4fde/64 Scope:Link
另一个节点操作,将HTZ62的VIP地址手动启动到htz63主机上面
[root@htz63 admin]# ifconfig -a|grep addr
eth0 Link encap:Ethernet HWaddr 00:0C:29:B3:91:4A
inet addr:192.168.188.63 Bcast:192.168.188.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:feb3:914a/64 Scope:Link
Base address:0x2400 Memory:c9060000-c9080000
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:B3:91:4A
inet addr:192.168.188.65 Bcast:192.168.188.255 Mask:255.255.255.0
Base address:0x2400 Memory:c9060000-c9080000
手动在htz63启动源htz62的VIP地址
[root@htz63 admin]# crs_stat -t
Name Type Target State Host
————————————————————
ora.htz.db application OFFLINE OFFLINE
ora….z1.inst application OFFLINE OFFLINE
ora….z2.inst application OFFLINE OFFLINE
ora….SM1.asm application OFFLINE OFFLINE
ora….62.lsnr application OFFLINE OFFLINE
ora.htz62.gsd application ONLINE ONLINE htz62
ora.htz62.ons application ONLINE ONLINE htz62
ora.htz62.vip application OFFLINE OFFLINE
ora….SM2.asm application OFFLINE OFFLINE
ora….63.lsnr application OFFLINE OFFLINE
ora.htz63.gsd application ONLINE ONLINE htz63
ora.htz63.ons application ONLINE ONLINE htz63
ora.htz63.vip application ONLINE ONLINE htz63
[root@htz63 admin]# crs_start ora.htz62.vip -c htz63
Attempting to start `ora.htz62.vip` on member `htz63`
Start of `ora.htz62.vip` on member `htz63` succeeded.
[root@htz63 admin]# crs_stat -t
Name Type Target State Host
————————————————————
ora.htz.db application OFFLINE OFFLINE
ora….z1.inst application OFFLINE OFFLINE
ora….z2.inst application OFFLINE OFFLINE
ora….SM1.asm application OFFLINE OFFLINE
ora….62.lsnr application OFFLINE OFFLINE
ora.htz62.gsd application ONLINE ONLINE htz62
ora.htz62.ons application ONLINE ONLINE htz62
ora.htz62.vip application ONLINE ONLINE htz63
ora….SM2.asm application OFFLINE OFFLINE
ora….63.lsnr application OFFLINE OFFLINE
ora.htz63.gsd application ONLINE ONLINE htz63
ora.htz63.ons application ONLINE ONLINE htz63
ora.htz63.vip application ONLINE ONLINE htz63
[root@htz63 admin]# ifconfig -a|grep addr
eth0 Link encap:Ethernet HWaddr 00:0C:29:B3:91:4A
inet addr:192.168.188.63 Bcast:192.168.188.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:feb3:914a/64 Scope:Link
Base address:0x2400 Memory:c9060000-c9080000
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:B3:91:4A
inet addr:192.168.188.65 Bcast:192.168.188.255 Mask:255.255.255.0
Base address:0x2400 Memory:c9060000-c9080000
eth0:2 Link encap:Ethernet HWaddr 00:0C:29:B3:91:4A
inet addr:192.168.188.64 Bcast:192.168.188.255 Mask:255.255.255.0
Base address:0x2400 Memory:c9060000-c9080000
这里看到64已经成功启动到htz63主机上面
4.2 relocate VIP资源
[root@htz63 admin]# crs_relocate -f ora.htz63.vip -c htz62
Attempting to stop `ora.htz63.vip` on member `htz63`
Stop of `ora.htz63.vip` on member `htz63` succeeded.
Attempting to start `ora.htz63.vip` on member `htz62`
Start of `ora.htz63.vip` on member `htz62` succeeded.
root@htz62 admin]# ifconfig -a|grep addr
eth0 Link encap:Ethernet HWaddr 00:0C:29:84:4F:D4
inet addr:192.168.188.62 Bcast:192.168.188.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe84:4fd4/64 Scope:Link
Base address:0x2400 Memory:c9060000-c9080000
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:84:4F:D4
inet addr:192.168.111.64 Bcast:192.168.111.255 Mask:255.255.255.0
Base address:0x2400 Memory:c9060000-c9080000
eth0:2 Link encap:Ethernet HWaddr 00:0C:29:84:4F:D4
inet addr:192.168.188.64 Bcast:192.168.188.255 Mask:255.255.255.0
Base address:0x2400 Memory:c9060000-c9080000
eth0:3 Link encap:Ethernet HWaddr 00:0C:29:84:4F:D4
inet addr:192.168.188.65 Bcast:192.168.188.255 Mask:255.255.255.0
Base address:0x2400 Memory:c9060000-c9080000
[root@htz62 admin]# crs_stat -t
Name Type Target State Host
————————————————————
ora.htz.db application OFFLINE OFFLINE
ora….z1.inst application OFFLINE OFFLINE
ora….z2.inst application OFFLINE OFFLINE
ora….SM1.asm application OFFLINE OFFLINE
ora….62.lsnr application ONLINE ONLINE htz62
ora.htz62.gsd application ONLINE ONLINE htz62
ora.htz62.ons application ONLINE ONLINE htz62
ora.htz62.vip application ONLINE ONLINE htz62
ora….SM2.asm application OFFLINE OFFLINE
ora….63.lsnr application OFFLINE OFFLINE
ora.htz63.gsd application ONLINE ONLINE htz63
ora.htz63.ons application ONLINE ONLINE htz63
ora.htz63.vip application ONLINE ONLINE htz62
[root@htz62 admin]# crs_relocate ora.htz63.vip
Attempting to stop `ora.htz63.vip` on member `htz62`
Stop of `ora.htz63.vip` on member `htz62` succeeded.
Attempting to start `ora.htz63.vip` on member `htz63`
Start of `ora.htz63.vip` on member `htz63` succeeded.
------------------作者介绍-----------------------
姓名:黄廷忠
现就职:Oracle中国高级服务团队
曾就职:OceanBase、云和恩墨、东方龙马等
电话、微信、QQ:18081072613
个人博客: (http://www.htz.pw)
CSDN地址: (https://blog.csdn.net/wwwhtzpw)
博客园地址: (https://www.cnblogs.com/www-htz-pw)

提供ORACLE技术支持(系统优化,故障处理,安装升级,数据恢复等) TEL:18081072613,微信、QQ同手机号。
浙公网安备 33010602011771号