Oracle 10g RAC修改IP/VIP地址樣本
一、準備工作1. 資料庫資訊
作業系統版本 : OEL5.4 x64
資料庫版本 : Oracle 10.2.0.5 x64 RAC
2. IP地址對應資訊
說明: 伺服器主機名稱不能更改,如確實要改名,需要重裝CRS解決,還不如重新安裝呢。
本文環境是10g rac+ocfs+asm,心跳地址不變,IP地址因環境限制暫時採用同一個網段,不同的IP地址,但是過程與不同網段改名一致。
原IP地址:
192.168.0.6 node1 修改為: 192.168.0.206
192.168.0.7 node2 修改為: 192.168.0.207
192.168.0.8 node1-vip 修改為: 192.168.0.208
192.168.0.9 node2-vip 修改為: 192.168.0.209
10.10.10.10 node1-priv 不變
10.10.10.20 node2-priv 不變
調整後IP地址:
192.168.0.206 node1
192.168.0.207 node2
192.168.0.208 node1-vip
192.168.0.209 node2-vip
10.10.10.10 node1-priv
10.10.10.20 node2-priv
二、停止oracle rac服務。1. 關閉ORACLE RAC進程, 可在任一節點上執行,這裡採用節點1.
[root@node1 ~]# cd /u01/app/oracle/product/10.2.0/crs/bin
[root@node1 ~]# pwd
/u01/app/oracle/product/10.2.0/crs/bin
# 依次關閉資料庫, asm, node application, crs
[root@node1 bin]# ./srvctl stop database -d orcl
[root@node1 bin]# ./srvctl stop asm -n node1
[root@node1 bin]# ./srvctl stop asm -n node2
[root@node1 bin]# ./srvctl stop nodeapps -n node1
[root@node1 bin]# ./srvctl stop nodeapps -n node2
# 查看關閉情況
[root@node1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application OFFLINE OFFLINE
ora....E1.lsnr application OFFLINE OFFLINE
ora.node1.gsd application OFFLINE OFFLINE
ora.node1.ons application OFFLINE OFFLINE
ora.node1.vip application OFFLINE OFFLINE
ora....SM2.asm application OFFLINE OFFLINE
ora....E2.lsnr application OFFLINE OFFLINE
ora.node2.gsd application OFFLINE OFFLINE
ora.node2.ons application OFFLINE OFFLINE
ora.node2.vip application OFFLINE OFFLINE
ora.orcl.db application OFFLINE OFFLINE
ora....l1.inst application OFFLINE OFFLINE
ora....l2.inst application OFFLINE OFFLINE
2. 關閉crs後台進程
#註:必須在所有(node1,node2)節點上root使用者執行。
[root@node1 bin]# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
[root@node2 bin]# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
三、 修改伺服器IP地址1. node1,node2 修改 /etc/hosts 檔案。 保持2個節點的一致
[root@node1 bin]# vi /etc/hosts
192.168.0.206 node1
192.168.0.207 node2
192.168.0.208 node1-vip
192.168.0.209 node2-vip
10.10.10.10 node1-priv
10.10.10.20 node2-priv
2. 在兩個節點上分別修改eth0地址、網關,心跳地址不變,不改動。
node1節點:
[root@node1 bin]# more /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0C:29:EA:C7:1F
IPADDR=192.168.0.206
NETMASK=255.255.255.0
ONBOOT=yes
node2節點:
[root@node2 bin]# more /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.0.207
NETMASK=255.255.255.0
HWADDR=00:0c:29:6c:08:aa
3. 重啟網路服務
# service network restart
# service network restart
四、啟動crs.1. 在兩個節點(node1,node2)啟動crs, 並關閉隨crs啟動的服務
[root@node1 bin]# /etc/init.d/init.crs start
Startup will be queued to init within 30 seconds.
[root@node2 bin]# /etc/init.d/init.crs start
Startup will be queued to init within 30 seconds.
#由於IP地址還未修改完成,一些伺服器無法啟動成功,需要關閉掉。
[root@node1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE OFFLINE
ora.node1.gsd application ONLINE OFFLINE
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE OFFLINE
ora.node2.gsd application ONLINE OFFLINE
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2
ora.orcl.db application ONLINE OFFLINE
ora....l1.inst application ONLINE OFFLINE
ora....l2.inst application ONLINE OFFLINE
#關閉所有服務
[root@node1 bin]# ./srvctl stop database -d orcl
[root@node1 bin]# ./srvctl stop asm -n node1
[root@node1 bin]# ./srvctl stop asm -n node2
[root@node1 bin]# ./srvctl stop nodeapps -n node1
[root@node1 bin]# ./srvctl stop nodeapps -n node2
#確認關閉
[root@node1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application OFFLINE OFFLINE
ora....E1.lsnr application OFFLINE OFFLINE
ora.node1.gsd application OFFLINE OFFLINE
ora.node1.ons application OFFLINE OFFLINE
ora.node1.vip application OFFLINE OFFLINE
ora....SM2.asm application OFFLINE OFFLINE
ora....E2.lsnr application OFFLINE OFFLINE
ora.node2.gsd application OFFLINE OFFLINE
ora.node2.ons application OFFLINE OFFLINE
ora.node2.vip application OFFLINE OFFLINE
ora.orcl.db application OFFLINE OFFLINE
ora....l1.inst application OFFLINE OFFLINE
ora....l2.inst application OFFLINE OFFLINE
[root@node1 bin]#
2. 使用oifcfg修改網卡設定, oifconfig可以用來設定和查看網卡使用的方式.
��: node1,node2上操作,如果修改的網段相同,可以不做,但是如果其它網段,可以按如下方式
#查看當前配置
[root@node1 bin]# ./oifcfg getif -global
eth0 192.168.0.0 global public
eth1 10.10.10.0 global cluster_interconnect
#刪除當前配置
[root@node1 bin]# ./oifcfg delif -global eth0
[root@node1 bin]# ./oifcfg delif -global eth1
[root@node1 bin]# ./oifcfg getif
#重新添加,內聯及心跳網段(對應IP地址子網路遮罩配置網段)
[root@node1 bin]# ./oifcfg setif -global eth0/192.168.0.0:public
[root@node1 bin]# ./oifcfg setif -global eth1/10.10.10.0:cluster_interconnect
[root@node1 bin]# ./oifcfg getif
eth0 192.168.0.0 global public
eth1 10.10.10.0 global cluster_interconnect
[root@node1 bin]# ./oifcfg iflist
eth0 192.168.0.0
eth1 10.10.10.0
3. node1,node2 修改VIP地址
[root@node1 bin]# ./srvctl modify nodeapps -n node1 -A 192.168.0.208/255.255.255.0/eth0
[root@node1 bin]# ./srvctl modify nodeapps -n node2 -A 192.168.0.209/255.255.255.0/eth0
4. node1,node2 設定listener.ora和tnsnames.ora
#查看原IP地址,修改為現在的IP地址。
[root@node1 bin]# vi /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
SID_LIST_LISTENER_NODE1 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
)
LISTENER_NODE1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521)(IP = FIRST))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.206)(PORT = 1521)(IP = FIRST))
)
)
5. node1上操作,啟動node 應用, asm, 資料庫
[root@node1 bin]# ./srvctl start nodeapps -n node1
[root@node1 bin]# ./srvctl start nodeapps -n node2
[root@node1 bin]# ./srvctl start asm -n node1
[root@node1 bin]# ./srvctl start asm -n node2
[root@node1 bin]# ./srvctl start instance -d orcl -i orcl1
[root@node1 bin]# ./srvctl start instance -d orcl -i orcl2
[root@node1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2
ora.orcl.db application ONLINE ONLINE node2
ora....l1.inst application ONLINE ONLINE node1
ora....l2.inst application ONLINE ONLINE node2
若啟動出現問題,再進行判斷 。
6. 確認IP, 修改完成。
[root@node1 bin]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:EA:C7:1F
inet addr:192.168.0.206 Bcast:192.168.0.255 Mask:255.255.255.0
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:EA:C7:1F
inet addr:192.168.0.208 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth1 Link encap:Ethernet HWaddr 00:0C:29:EA:C7:29
inet addr:10.10.10.10 Bcast:10.10.10.255 Mask:255.255.255.0
[root@node2 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:6C:08:AA
inet addr:192.168.0.207 Bcast:192.168.0.255 Mask:255.255.255.0
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:6C:08:AA
inet addr:192.168.0.209 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth1 Link encap:Ethernet HWaddr 00:0C:29:6C:08:B4
inet addr:10.10.10.20 Bcast:10.10.10.255 Mask:255.255.255.0
7. 重啟節點測試,rac啟動均正常,無問題。