【VIP】調整RAC虛擬IP地址(VIP)及虛擬主機名
本文給出在Linux作業系統中如何調整RAC虛擬IP地址和虛擬主機名的方法。
在多節點RAC環境中,我們可以使用逐節點調整的策略來完成RAC環境中各節點VIP修改任務。
1.獲取系統當前VIP資訊
使用“ifconfig –a”命令,可以得到VIP是被繫結在eth0這個網路介面上。
1)確認rac1節點上VIP資訊
[root@rac1 ~]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0C:29:2C:74:42
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe2c:7442/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2607265 errors:0 dropped:0 overruns:0 frame.:0
TX packets:3593990 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:224517544 (214.1 MiB) TX bytes:2273656220 (2.1 GiB)
Interrupt:185 Base address:0x1480
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:2C:74:42
inet addr:192.168.1.200 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1480
eth1 Link encap:Ethernet HWaddr 00:0C:29:2C:74:4C
inet addr:192.168.2.100 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe2c:744c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1565284 errors:27 dropped:27 overruns:0 frame.:0
TX packets:1637772 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:753478388 (718.5 MiB) TX bytes:889262981 (848.0 MiB)
Interrupt:193 Base address:0x1800
2)確認rac2節點上VIP資訊
[root@rac2 ~]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0C:29:8F:F1:87
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe8f:f187/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3567795 errors:34 dropped:34 overruns:0 frame.:0
TX packets:2587235 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2271730645 (2.1 GiB) TX bytes:222997239 (212.6 MiB)
Interrupt:185 Base address:0x1480
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:8F:F1:87
inet addr:192.168.1.201 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1480
eth1 Link encap:Ethernet HWaddr 00:0C:29:8F:F1:91
inet addr:192.168.2.101 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe8f:f191/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1674459 errors:17 dropped:17 overruns:0 frame.:0
TX packets:1529165 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:894329474 (852.8 MiB) TX bytes:748919151 (714.2 MiB)
Interrupt:193 Base address:0x1800
3)在作業系統的hosts檔案中同樣記錄了有關VIP的資訊
[root@rac1 ~]# cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
##Public Network - (eth0)
##Private Interconnect - (eth1)
##Public Virtual IP (VIP) addresses - (eth0)
192.168.1.100 rac1
192.168.1.101 rac2
192.168.2.100 rac1-priv
192.168.2.101 rac2-priv
192.168.1.200 rac1-vip
192.168.1.201 rac2-vip
2.停掉所有與VIP相關的資源
停止順序:①停止資料庫例項;②停止ASM例項;③停止nodeapps。
1)確認叢集當前狀態
RACDB1@rac1 /home/oracle$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application ONLINE ONLINE rac1
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....DB1.srv application ONLINE ONLINE rac1
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
2)停掉第一節點上的資料庫例項
RACDB1@rac1 /home/oracle$ srvctl stop instance -d RACDB -i RACDB1
RACDB1@rac1 /home/oracle$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application OFFLINE OFFLINE
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....DB1.srv application ONLINE OFFLINE
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
3)停掉第一節點上的ASM例項
RACDB1@rac1 /home/oracle$ srvctl stop asm -n rac1
RACDB1@rac1 /home/oracle$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application OFFLINE OFFLINE
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....DB1.srv application ONLINE OFFLINE
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application OFFLINE OFFLINE
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
4)停掉第一節點上的nodeapps
RACDB1@rac1 /home/oracle$ srvctl stop nodeapps -n rac1
RACDB1@rac1 /home/oracle$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application OFFLINE OFFLINE
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....DB1.srv application ONLINE OFFLINE
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application OFFLINE OFFLINE
ora....C1.lsnr application OFFLINE OFFLINE
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application OFFLINE OFFLINE
ora.rac1.vip application OFFLINE OFFLINE
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
3.再次確認VIP已停用
可以使用兩種方法來確認:①使用“ifconfig -a”命令;②使用“crs_stat -t”命令
1)使用“ifconfig -a”命令確認VIP已經停用
RACDB1@rac1 /home/oracle$ ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0C:29:2C:74:42
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe2c:7442/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2610383 errors:0 dropped:0 overruns:0 frame.:0
TX packets:3597024 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:224799562 (214.3 MiB) TX bytes:2273932379 (2.1 GiB)
Interrupt:185 Base address:0x1480
eth1 Link encap:Ethernet HWaddr 00:0C:29:2C:74:4C
inet addr:192.168.2.100 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe2c:744c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1568619 errors:27 dropped:27 overruns:0 frame.:0
TX packets:1641668 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:755141636 (720.1 MiB) TX bytes:891343331 (850.0 MiB)
Interrupt:193 Base address:0x1800
可見原有的“eth0:1”資訊已經不存在,表示VIP已經停止。
2)使用“crs_stat -t”命令確認VIP已經停用
RACDB1@rac1 /home/oracle$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application OFFLINE OFFLINE
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....DB1.srv application ONLINE OFFLINE
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application OFFLINE OFFLINE
ora....C1.lsnr application OFFLINE OFFLINE
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application OFFLINE OFFLINE
ora.rac1.vip application OFFLINE OFFLINE
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
第一節點上的VIP已經停止。
4.修改“/etc/hosts”檔案中有關VIP的資訊
[root@rac1 ~]# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
##Public Network - (eth0)
##Private Interconnect - (eth1)
##Public Virtual IP (VIP) addresses - (eth0)
192.168.1.100 rac1
192.168.1.101 rac2
192.168.2.100 rac1-priv
192.168.2.101 rac2-priv
192.168.3.100 rac1-vip
192.168.3.101 rac2-vip
這裡我們將第一節點的VIP調整為“192.168.3.100”,第二節點的VIP調整為“192.168.3.101”。
BTW:如果要同時調整虛擬主機名,可以在此一併進行調整。將“rac1-vip”和“rac2-vip”修改為需要的內容,同時需要調整listener.ora、tnsnames.ora和初始化引數檔案中與之有關的內容。
5.使用srvctl命令調整VIP地址
注意需要以root使用者身份完成此步調整。
[root@rac1 ~]# srvctl modify nodeapps -n rac1 -A 192.168.3.100/255.255.255.0/eth0
該命令給出了新的VIP地址“192.168.3.100”、網路掩碼“255.255.255.0”和VIP使用的網路卡“eth0”。
6.啟動與VIP相關的資源及資料庫例項
1)啟動nodeapps
[root@rac1 ~]# srvctl start nodeapps -n rac1
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application OFFLINE OFFLINE
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....DB1.srv application ONLINE OFFLINE
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application OFFLINE OFFLINE
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
2)啟動ASM例項
[root@rac1 ~]# srvctl start asm -n rac1
[root@rac1 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application OFFLINE OFFLINE
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....DB1.srv application ONLINE OFFLINE
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
3)啟動資料庫例項
[root@rac1 ~]# srvctl start instance -d RACDB -i RACDB1
[root@rac1 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application ONLINE ONLINE rac1
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....DB1.srv application ONLINE ONLINE rac1
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
到此第一節點的VIP修改完畢。
7.確認第一個節點的VIP修改完畢
[root@rac1 ~]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0C:29:2C:74:42
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe2c:7442/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2639780 errors:0 dropped:0 overruns:0 frame.:0
TX packets:3626218 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:227444406 (216.9 MiB) TX bytes:2276551395 (2.1 GiB)
Interrupt:185 Base address:0x1480
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:2C:74:42
inet addr:192.168.3.100 Bcast:192.168.3.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1480
eth1 Link encap:Ethernet HWaddr 00:0C:29:2C:74:4C
inet addr:192.168.2.100 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe2c:744c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1598818 errors:27 dropped:27 overruns:0 frame.:0
TX packets:1661789 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:775634542 (739.7 MiB) TX bytes:897306993 (855.7 MiB)
Interrupt:193 Base address:0x1800
從“eth0:1”給出的資訊看,第一節點的VIP已經調整完畢。
8.調整RAC其餘節點的VIP
按照上述步驟操作後,便完成了一個節點的VIP調整,按照如上步驟依次調整其他節點的VIP資訊即可實現滾動調整VIP的目的。
9.小結
調整RAC環境中各節點VIP及虛擬主機名的步驟相對比較簡單。但有一些需要重點注意的地方:
1)如果listener.ora、tnsnames.ora和初始化引數檔案中使用的是VIP的地址而不是虛擬主機的名字,需要將其內容調整為新的VIP地址;
2)如果在調整VIP地址過程中同時修改了虛擬主機的名字,注意需要同時修改listener.ora、tnsnames.ora和初始化引數檔案;
3)需要調整客戶端tnsnames.ora檔案中有關VIP的配置資訊。
Good luck.
secooler
10.11.16
-- The End --
在多節點RAC環境中,我們可以使用逐節點調整的策略來完成RAC環境中各節點VIP修改任務。
1.獲取系統當前VIP資訊
使用“ifconfig –a”命令,可以得到VIP是被繫結在eth0這個網路介面上。
1)確認rac1節點上VIP資訊
[root@rac1 ~]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0C:29:2C:74:42
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe2c:7442/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2607265 errors:0 dropped:0 overruns:0 frame.:0
TX packets:3593990 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:224517544 (214.1 MiB) TX bytes:2273656220 (2.1 GiB)
Interrupt:185 Base address:0x1480
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:2C:74:42
inet addr:192.168.1.200 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1480
eth1 Link encap:Ethernet HWaddr 00:0C:29:2C:74:4C
inet addr:192.168.2.100 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe2c:744c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1565284 errors:27 dropped:27 overruns:0 frame.:0
TX packets:1637772 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:753478388 (718.5 MiB) TX bytes:889262981 (848.0 MiB)
Interrupt:193 Base address:0x1800
2)確認rac2節點上VIP資訊
[root@rac2 ~]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0C:29:8F:F1:87
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe8f:f187/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3567795 errors:34 dropped:34 overruns:0 frame.:0
TX packets:2587235 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2271730645 (2.1 GiB) TX bytes:222997239 (212.6 MiB)
Interrupt:185 Base address:0x1480
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:8F:F1:87
inet addr:192.168.1.201 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1480
eth1 Link encap:Ethernet HWaddr 00:0C:29:8F:F1:91
inet addr:192.168.2.101 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe8f:f191/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1674459 errors:17 dropped:17 overruns:0 frame.:0
TX packets:1529165 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:894329474 (852.8 MiB) TX bytes:748919151 (714.2 MiB)
Interrupt:193 Base address:0x1800
3)在作業系統的hosts檔案中同樣記錄了有關VIP的資訊
[root@rac1 ~]# cat /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
##Public Network - (eth0)
##Private Interconnect - (eth1)
##Public Virtual IP (VIP) addresses - (eth0)
192.168.1.100 rac1
192.168.1.101 rac2
192.168.2.100 rac1-priv
192.168.2.101 rac2-priv
192.168.1.200 rac1-vip
192.168.1.201 rac2-vip
2.停掉所有與VIP相關的資源
停止順序:①停止資料庫例項;②停止ASM例項;③停止nodeapps。
1)確認叢集當前狀態
RACDB1@rac1 /home/oracle$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application ONLINE ONLINE rac1
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....DB1.srv application ONLINE ONLINE rac1
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
2)停掉第一節點上的資料庫例項
RACDB1@rac1 /home/oracle$ srvctl stop instance -d RACDB -i RACDB1
RACDB1@rac1 /home/oracle$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application OFFLINE OFFLINE
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....DB1.srv application ONLINE OFFLINE
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
3)停掉第一節點上的ASM例項
RACDB1@rac1 /home/oracle$ srvctl stop asm -n rac1
RACDB1@rac1 /home/oracle$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application OFFLINE OFFLINE
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....DB1.srv application ONLINE OFFLINE
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application OFFLINE OFFLINE
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
4)停掉第一節點上的nodeapps
RACDB1@rac1 /home/oracle$ srvctl stop nodeapps -n rac1
RACDB1@rac1 /home/oracle$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application OFFLINE OFFLINE
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....DB1.srv application ONLINE OFFLINE
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application OFFLINE OFFLINE
ora....C1.lsnr application OFFLINE OFFLINE
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application OFFLINE OFFLINE
ora.rac1.vip application OFFLINE OFFLINE
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
3.再次確認VIP已停用
可以使用兩種方法來確認:①使用“ifconfig -a”命令;②使用“crs_stat -t”命令
1)使用“ifconfig -a”命令確認VIP已經停用
RACDB1@rac1 /home/oracle$ ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0C:29:2C:74:42
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe2c:7442/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2610383 errors:0 dropped:0 overruns:0 frame.:0
TX packets:3597024 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:224799562 (214.3 MiB) TX bytes:2273932379 (2.1 GiB)
Interrupt:185 Base address:0x1480
eth1 Link encap:Ethernet HWaddr 00:0C:29:2C:74:4C
inet addr:192.168.2.100 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe2c:744c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1568619 errors:27 dropped:27 overruns:0 frame.:0
TX packets:1641668 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:755141636 (720.1 MiB) TX bytes:891343331 (850.0 MiB)
Interrupt:193 Base address:0x1800
可見原有的“eth0:1”資訊已經不存在,表示VIP已經停止。
2)使用“crs_stat -t”命令確認VIP已經停用
RACDB1@rac1 /home/oracle$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application OFFLINE OFFLINE
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....DB1.srv application ONLINE OFFLINE
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application OFFLINE OFFLINE
ora....C1.lsnr application OFFLINE OFFLINE
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application OFFLINE OFFLINE
ora.rac1.vip application OFFLINE OFFLINE
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
第一節點上的VIP已經停止。
4.修改“/etc/hosts”檔案中有關VIP的資訊
[root@rac1 ~]# vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
##Public Network - (eth0)
##Private Interconnect - (eth1)
##Public Virtual IP (VIP) addresses - (eth0)
192.168.1.100 rac1
192.168.1.101 rac2
192.168.2.100 rac1-priv
192.168.2.101 rac2-priv
192.168.3.100 rac1-vip
192.168.3.101 rac2-vip
這裡我們將第一節點的VIP調整為“192.168.3.100”,第二節點的VIP調整為“192.168.3.101”。
BTW:如果要同時調整虛擬主機名,可以在此一併進行調整。將“rac1-vip”和“rac2-vip”修改為需要的內容,同時需要調整listener.ora、tnsnames.ora和初始化引數檔案中與之有關的內容。
5.使用srvctl命令調整VIP地址
注意需要以root使用者身份完成此步調整。
[root@rac1 ~]# srvctl modify nodeapps -n rac1 -A 192.168.3.100/255.255.255.0/eth0
該命令給出了新的VIP地址“192.168.3.100”、網路掩碼“255.255.255.0”和VIP使用的網路卡“eth0”。
6.啟動與VIP相關的資源及資料庫例項
1)啟動nodeapps
[root@rac1 ~]# srvctl start nodeapps -n rac1
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application OFFLINE OFFLINE
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....DB1.srv application ONLINE OFFLINE
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application OFFLINE OFFLINE
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
2)啟動ASM例項
[root@rac1 ~]# srvctl start asm -n rac1
[root@rac1 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application OFFLINE OFFLINE
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....DB1.srv application ONLINE OFFLINE
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
3)啟動資料庫例項
[root@rac1 ~]# srvctl start instance -d RACDB -i RACDB1
[root@rac1 ~]# crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....B1.inst application ONLINE ONLINE rac1
ora....B2.inst application ONLINE ONLINE rac2
ora.RACDB.db application ONLINE ONLINE rac1
ora....DB1.srv application ONLINE ONLINE rac1
ora....DB2.srv application ONLINE ONLINE rac2
ora.....taf.cs application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
到此第一節點的VIP修改完畢。
7.確認第一個節點的VIP修改完畢
[root@rac1 ~]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0C:29:2C:74:42
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe2c:7442/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2639780 errors:0 dropped:0 overruns:0 frame.:0
TX packets:3626218 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:227444406 (216.9 MiB) TX bytes:2276551395 (2.1 GiB)
Interrupt:185 Base address:0x1480
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:2C:74:42
inet addr:192.168.3.100 Bcast:192.168.3.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:185 Base address:0x1480
eth1 Link encap:Ethernet HWaddr 00:0C:29:2C:74:4C
inet addr:192.168.2.100 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe2c:744c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1598818 errors:27 dropped:27 overruns:0 frame.:0
TX packets:1661789 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:775634542 (739.7 MiB) TX bytes:897306993 (855.7 MiB)
Interrupt:193 Base address:0x1800
從“eth0:1”給出的資訊看,第一節點的VIP已經調整完畢。
8.調整RAC其餘節點的VIP
按照上述步驟操作後,便完成了一個節點的VIP調整,按照如上步驟依次調整其他節點的VIP資訊即可實現滾動調整VIP的目的。
9.小結
調整RAC環境中各節點VIP及虛擬主機名的步驟相對比較簡單。但有一些需要重點注意的地方:
1)如果listener.ora、tnsnames.ora和初始化引數檔案中使用的是VIP的地址而不是虛擬主機的名字,需要將其內容調整為新的VIP地址;
2)如果在調整VIP地址過程中同時修改了虛擬主機的名字,注意需要同時修改listener.ora、tnsnames.ora和初始化引數檔案;
3)需要調整客戶端tnsnames.ora檔案中有關VIP的配置資訊。
Good luck.
secooler
10.11.16
-- The End --
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28389881/viewspace-1250983/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- (轉)【VIP】調整RAC虛擬IP地址(VIP)及虛擬主機名
- oracle10g RAC更改主機public地址及vip地址Oracle
- Oracle RAC修改IP和VIP地址Oracle
- RAC中的虛擬IP
- VMware虛擬機器如何設定使主機和虛擬機器不同IP虛擬機
- 一臺主機虛擬多個ip
- Nomachine_虛擬桌面_調整虛擬桌面解析度Mac
- 福音 虛擬主機
- 虛擬機器(三)虛擬機器配置靜態Ip虛擬機
- VMware安裝虛擬機器時,全名、使用者名稱、虛擬機器名是什麼。修改虛擬機器為靜態ip虛擬機
- 10G RAC 的虛擬IP
- 虛擬主機商如何搭建下一代虛擬主機
- RAC中修改IP, VIP
- Nginx虛擬主機配置Nginx
- uWSGI 虛擬主機模式模式
- linux配置基於ip的虛擬主機Linux
- RAC 11.2.0.3 修改VIP地址
- 實體地址、虛擬地址
- 調整vmware虛擬機器硬碟空間的方法虛擬機硬碟
- VMware 虛擬機器,配置 Ubuntu 22.04 靜態 IP 地址。虛擬機Ubuntu
- [php]apache虛擬主機配置PHPApache
- Nginx虛擬主機VirtualHost配置Nginx
- nginx虛擬主機實戰Nginx
- RAC改VIP和SCAN IP
- 【RAC】因虛擬機器配置檔案調整不完整導致RAC無法使用虛擬機
- Linux虛擬主機與Windows虛擬主機之間有什麼區別LinuxWindows
- rac 改public 及vip IP---備份01
- Dalvik虛擬機器、Java虛擬機器與ART虛擬機器虛擬機Java
- 配置虛擬機器叢集常用設定主機IP操作虛擬機
- suse 增加虛擬ip
- kvm 修改虛擬機器名稱虛擬機
- 如何為VMware的多臺虛擬機器繫結IP地址虛擬機
- 007.Nginx虛擬主機Nginx
- 虛擬主機php.ini在哪PHP
- apache虛擬web主機構建ApacheWeb
- Nginx實戰(一) 虛擬主機Nginx
- nginx多個虛擬主機noinputfilespecifiedNginx
- 主機ping不了虛擬機器虛擬機