sitemap

RSS地图

收藏本站

设为首页

Oracle研究中心

当前位置:Oracle研究中心 > 产品DBA > Oracle RAC >

【学习笔记】Oracle 10G RAC修改VIP地址并手动启动/关闭VIP资源

时间:2016-10-25 21:19   来源:Oracle研究中心   作者:HTZ   点击:

天萃荷净 Oracle研究中心学习笔记:分享一篇关于Oracle 10G RAC数据库手动管理VIP资源,并修改VIP地址的方法步骤。

环境介绍:

由于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
iOracleоnet6 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.

本文固定链接: http://www.htz.pw/2014/06/16/10g-rac%e4%bf%ae%e6%94%b9vip%e5%9c%b0%e5%9d%80%e4%b8%8e%e6%89%8b%e5%8a%a8%e5%90%af%e5%8a%a8%e5%85%b3%e9%97%advip%e8%b5%84%e6%ba%90.html | 认真就输

--------------------------------------ORACLE-DBA----------------------------------------

最权威、专业的Oracle案例资源汇总之【学习笔记】Oracle 10G RAC修改VIP地址并手动启动/关闭VIP资源

本文由大师惜分飞原创分享,网址:http://www.oracleplus.net/arch/1065.html

Oracle研究中心

关键词:

Oracle RAC手动管理VIP资源

Oracle 10G RAC修改VIP地址的详细步骤