1. 程式人生 > >Oracle RAC 修改 IP 地址

Oracle RAC 修改 IP 地址

RAC 修改IP 這個操作本身也只有幾步操作,但是它涉及到OCR所以要格外小心。一般來說,如果不是必須要修改的話,儘量不要去修改OCR 的東西。穩定第一。

在做之前,要手動的OCR 進行一個備份,這樣即使修改失敗,也能還原回來。 OCR的備份,參考Blog

Oracle 10g RAC OCR VotingDisk 的備份與恢復

另外Public/Private對應的的主機名不能更改,如果確實需要更改主機名,需要重新安裝CRS

實驗對IP 地址做如下修改:

Public IP 10.85.10.119/121-- >10.85.10.219/221

Privite IP 192.168.1.119/121-- >192.168.1.219/221

Virtual IP 10.85.10.122/123-- >10.85.10.222/223

實驗平臺: redhat 4.7 + ORACLE 10G + raw +ASM

一. 停止oracle相關的所有程序, 包括資料庫, asm, node application, crs本身.

1.1 檢視當前系統上crs執行的狀態
[[email protected] bin]# pwd

/u01/app/oracle/product/crs/bin

[[email protected] bin]# ./crs_stat -t

NameTypeTargetStateHost

------------------------------------------------------------

ora.raw.dbapplicationOFFLINEOFFLINE

ora.raw.dmm.cs applicationOFFLINEOFFLINE

ora....aw2.srv applicationOFFLINEOFFLINE

ora....w1.inst applicationOFFLINEOFFLINE

ora....w2.inst applicationOFFLINEOFFLINE

ora....SM1.asm applicationOFFLINEOFFLINE

ora....W1.lsnr applicationOFFLINEOFFLINE

ora.raw1.gsdapplicationOFFLINEOFFLINE

ora.raw1.onsapplicationOFFLINEOFFLINE

ora.raw1.vipapplicationOFFLINEOFFLINE

ora....SM2.asm applicationOFFLINEOFFLINE

ora....W2.lsnr applicationOFFLINEOFFLINE

ora.raw2.gsdapplicationOFFLINEOFFLINE

ora.raw2.onsapplicationOFFLINEOFFLINE

ora.raw2.vipapplicationOFFLINEOFFLINE

1.2 關閉資料庫[[email protected] bin]# ./srvctl stop database -d raw
1.3
關閉asm例項

[[email protected] bin]# ./srvctl stop asm -n raw1

[[email protected] bin]# ./srvctl stop asm -n raw2
1.4
關閉其他應用程式

[[email protected] bin]# ./srvctl stop nodeapps -n raw1

[[email protected] bin]# ./srvctl stop nodeapps -n raw2

1.5 關閉crs後臺程序, 在作業系統一級中止執行的crs後臺程序, 必須在所有節點上執行.
[[email protected] 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.


[[email protected] ~]# /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設定

2.1 修改 /etc/hosts 檔案。 保持2個節點的一致

[[email protected] bin]# vi /etc/hosts

# Do not remove the following line, or various programs

# that require network functionality will fail.

127.0.0.1 localhost

10.85.10.219 raw1

10.85.10.221 raw2

192.168.1.219 raw1-priv

192.168.1.221 raw2-priv

10.85.10.222 raw1-vip

10.85.10.223 raw2-vip

2.2 在兩個節點上分別修改eth0eth1地址:

[[email protected] etc]# more /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

BOOTPROTO=static

IPADDR=10.85.10.219

NETMASK=255.255.255.0

ONBOOT=yes

GATEWAY=10.85.10.253

[[email protected] ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

BOOTPROTO=static

IPADDR=10.85.10.221

NETMASK=255.255.255.0

ONBOOT=yes

GATEWAY=10.85.10.253

[[email protected] etc]# more /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

BOOTPROTO=static

IPADDR=192.168.1.219

NETMASK=255.255.255.0

ONBOOT=yes

GATEWAY=192.168.1.1

[[email protected] ~]# more /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

BOOTPROTO=static

IPADDR=192.168.1.221

NETMASK=255.255.255.0

ONBOOT=yes

GATEWAY=192.168.1.1

2.3 在兩個節點上分別重啟網路服務,是修改的IP生效。

[[email protected] ~]# service network restart

[[email protected] ~]# service network restart

三. 啟動crs, 設定oracleip地址相關的設定.  3.1 在兩個節點啟動crs, 並關閉隨crs啟動的應用程式
[[email protected] ~]# /etc/init.d/init.crs start

Startup will be queued to init within 90 seconds.

[[email protected] ~]#/etc/init.d/init.crs start

Startup will be queued to init within 90 seconds.

由於oracle所有應用設定為自動啟動, 所以在crs啟動時會試圖啟動所有的服務, 但是在對oracle相關的ip地址進行設定時需要crs處於執行狀態. 但是資料庫, asmnode application處於停止狀態, 在一個節點執行以下命令:[[email protected] bin]# ./srvctl stop database -d raw
[[email protected] bin]# ./srvctl stop asm -n raw1

[[email protected] bin]# ./srvctl stop asm -n raw2
[[email protected] bin]# ./srvctl stop nodeapps -n raw1

[[email protected] bin]# ./srvctl stop nodeapps -n raw2

[[email protected] bin]# ./crs_stat -t

NameTypeTargetStateHost

------------------------------------------------------------

ora.raw.dbapplicationOFFLINEOFFLINE

ora.raw.dmm.cs applicationOFFLINEOFFLINE

ora....aw2.srv applicationOFFLINEOFFLINE

ora....w1.inst applicationOFFLINEOFFLINE

ora....w2.inst applicationOFFLINEOFFLINE

ora....SM1.asm applicationOFFLINEOFFLINE

ora....W1.lsnr applicationOFFLINEOFFLINE

ora.raw1.gsdapplicationOFFLINEOFFLINE

ora.raw1.onsapplicationOFFLINEOFFLINE

ora.raw1.vipapplicationOFFLINEOFFLINE

ora....SM2.asm applicationOFFLINEOFFLINE

ora....W2.lsnr applicationOFFLINEOFFLINE

ora.raw2.gsdapplicationOFFLINEOFFLINE

ora.raw2.onsapplicationOFFLINEOFFLINE

ora.raw2.vipapplicationOFFLINEOFFLINE

3.2 使用oifcfg修改網絡卡設定, oifconfig可以用來設定和檢視網絡卡使用的方式.

注: 如果修改的網段相同,可以不做這一步。

-- 檢視當前配置:

[[email protected] bin]# ./oifcfg getif -global

eth010.85.10.0globalpublic

eth1192.168.1.0globalcluster_interconnect


--
刪除當前配置

[[email protected] bin]# ./oifcfg delif -global eth0

[[email protected] bin]# ./oifcfg delif -global eth1

[[email protected] bin]# ./oifcfg getif

-- 重新新增

[[email protected] bin]# ./oifcfg setif -global eth0/10.85.10.0:public

[[email protected] bin]# ./oifcfg setif -global eth1/192.168.1.0:cluster_interconnect

[[email protected] bin]#./oifcfg getif

eth010.85.10.0globalpublic

eth1192.168.1.0globalcluster_interconnect

[[email protected] bin]# ./oifcfg iflist

eth0192.168.86.0

eth1192.168.0.0

eth2192.168.200.0

eth3192.168.200.0

eth4192.168.200.0

eth5192.168.200.0

注意:這裡IP 地址最一個為0.  代表的是一個網段。修改的時候要切記。否在在啟動OCR 會報如下錯誤:

[  CRSOCR][4054413904] OCR context init failure.  Error: PROC-44: 網路地址和網路介面操作中出錯網路地址和網路介面操作錯誤 [7]

3.3 修改VIP

[[email protected] bin]# ./srvctl modify nodeapps -n raw1 -A 10.85.10.222/255.255.255.0/eth0

[[email protected] bin]# ./srvctl modify nodeapps -n raw2 -A 10.85.10.223/255.255.255.0/eth0

3.4 設定listener.oratnsnames.ora, 檢查這些檔案中是否有指定原來ip的地方, 修改為更改後的ip地址。

[[email protected] bin]# vi/u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora

# listener.ora.raw1 Network Configuration File:

/u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora.raw1

# Generated by Oracle configuration tools.

LISTENER_RAW1 =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = raw1-vip)(PORT = 1521)(IP = FIRST))

(ADDRESS = (PROTOCOL = TCP)(HOST = 10.85.10.219)(PORT = 1521)(IP = FIRST))

)

)

注意:如果你使用了ocfs,修改ocfs配置檔案(/etc/ocfs/cluster.conf),驗證修改後是否可用。

3.5 啟動node applications, asm, 資料庫

[[email protected] bin]# ./srvctl start nodeapps -n raw1

[[email protected] bin]# ./srvctl start nodeapps -n raw2

[[email protected] bin]# ./srvctl start asm -n raw1

[[email protected] bin]# ./srvctl start asm -n raw2

[[email protected] bin]# ./srvctl start instance -d raw -i raw1

[[email protected] bin]# ./srvctl start instance -d raw -i raw2

[[email protected] bin]# ./crs_stat -t

NameTypeTargetStateHost

------------------------------------------------------------

ora.raw.dbapplicationONLINEONLINEraw2

ora.raw.dmm.cs applicationONLINEONLINEraw2

ora....aw2.srv applicationONLINEONLINEraw2

ora....w1.inst applicationONLINEONLINEraw1

ora....w2.inst applicationONLINEONLINEraw2

ora....SM1.asm applicationONLINEONLINEraw1

ora....W1.lsnr applicationONLINEONLINEraw1

ora.raw1.gsdapplicationONLINEONLINEraw1

ora.raw1.onsapplicationONLINEONLINEraw1

ora.raw1.vipapplicationONLINEONLINEraw1

ora....SM2.asm applicationONLINEONLINEraw2

ora....W2.lsnr applicationONLINEONLINEraw2

ora.raw2.gsdapplicationONLINEONLINEraw2

ora.raw2.onsapplicationONLINEONLINEraw2

ora.raw2.vipapplicationONLINEONLINEraw2

若啟動出現問題,參考我的blog

Oracle RAC 啟動與關閉

http://blog.csdn.net/tianlesoftware/archive/2010/03/05/5349003.aspx

3.6 確認IP, 修改完成。
[[email protected] bin]# ifconfig

eth0Link encap:EthernetHWaddr 00:0C:29:55:28:FD

inet addr:10.85.10.219Bcast:10.85.10.255Mask:255.255.255.0

... ...

eth0:1Link encap:EthernetHWaddr 00:0C:29:55:28:FD

inet addr:10.85.10.222Bcast:10.85.10.255Mask:255.255.255.0

... ...

eth1Link encap:EthernetHWaddr 00:0C:29:55:28:07

inet addr:192.168.1.219Bcast:192.168.1.255Mask:255.255.255.0

... ...

loLink encap:Local Loopback

inet addr:127.0.0.1Mask:255.0.0.0

[[email protected] ~]# ifconfig

eth0Link encap:EthernetHWaddr 00:0C:29:2E:28:EE

inet addr:10.85.10.221Bcast:10.85.10.255Mask:255.255.255.0

... ...

eth0:1Link encap:EthernetHWaddr 00:0C:29:2E:28:EE

inet addr:10.85.10.223Bcast:10.85.10.255Mask:255.255.255.0

... ...

eth1Link encap:EthernetHWaddr 00:0C:29:2E:28:F8

inet addr:192.168.1.221Bcast:192.168.1.255Mask:255.255.255.0

... ...

loLink encap:Local Loopback

inet addr:127.0.0.1Mask:255.0.0.0

... ...

------------------------------------------------------------------------------
QQ: 492913789
Email: [email protected]
Blog: http://www.cndba.cn/dave
網上資源: http://tianlesoftware.download.csdn.net
相關視訊:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx
DBA1 群:62697716(滿);   DBA2 群:62697977(滿)   DBA3 群:62697850(滿)  
DBA 超級群:63306533(滿);  DBA4 群: 83829929  DBA5群: 142216823   
DBA6 群:158654907  聊天 群:40132017   聊天2群:69087192
--加群需要在備註說明Oracle表空間和資料檔案的關係,否則拒絕申請