RAC修改IP操作

yingyifeng306發表於2011-10-12
在做操作之前需要手工備份OCR,這樣即使修改失敗,也能還原回來
對IP 地址做如下修改:
192.168.72.30   rac1        -----&gt192.168.72.70
192.168.72.40   rac2        -----&gt192.168.72.80
192.168.72.31   rac1-vip    ------&gt192.168.72.71
192.168.72.41   rac2-vip    ------&gt192.168.72.81
10.10.10.30     rac1-priv   ------&gt11.11.11.70
10.10.10.40     rac2-priv   -------&gt11.11.11.80


一. 停止oracle相關的所有程式, 包括資料庫, asm, node application, crs本身.
1.1 檢視當前系統上crs執行的狀態
[root@rac1 oracle]# crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
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  
1.2 關閉資料庫
  [root@raw1 bin]# ./srvctl stop database -d raw
1.3 關閉asm例項
[root@rac1 oracle]# srvctl stop asm -n rac1
[root@rac1 oracle]# srvctl stop asm -n rac2
1.4 關閉其他應用程式
[root@rac1 oracle]# srvctl stop nodeapps -n rac1
[root@rac1 oracle]# srvctl stop nodeapps -n rac2

1.5 關閉crs後臺程式, 在作業系統一級中止執行的crs後臺程式, 必須在所有節點上執行.
一節點:
[root@rac1 oracle]# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
Sep 22 11:14:22.759 | INF | daemon shutting down
Stopping resources. This could take several minutes.
Successfully stopped CRS resources.
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
二節點:
[root@rac2 oracle]# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
Sep 22 11:15:00.995 | INF | daemon shutting down
Stopping resources. This could take several minutes.
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個節點的一致
[root@rac1 oracle]# 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


192.168.72.70   rac1
192.168.72.80   rac2
192.168.72.71   rac1-vip
192.168.72.81   rac2-vip
11.11.11.70     rac1-priv
11.11.11.80     rac2-priv 
2.2 在兩個節點上分別修改eth0和eth1地址:
一節點eth0:

[root@rac1 oracle]# more /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.72.255
HWADDR=00:0C:29:C8:3D:94
IPADDR=192.168.72.70
NETMASK=255.255.255.0
NETWORK=192.168.72.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes

 二節點eth0:
[root@rac2 oracle]# more /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=none
BROADCAST=192.168.72.255
HWADDR=00:0c:29:37:d0:3a
IPADDR=192.168.72.80
NETMASK=255.255.255.0
NETWORK=192.168.72.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes

 一節點eth1:
[root@rac1 oracle]# more /etc/sysconfig/network-scripts/ifcfg-eth1
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
IPADDR=11.11.11.70
NETMASK=255.0.0.0
HWADDR=00:0C:29:C8:3D:9E
USERCTL=no
IPV6INIT=no
PEERDNS=yes
TYPE=Ethernet
 
二節點eth1:
[root@rac2 oracle]# more /etc/sysconfig/network-scripts/ifcfg-eth1
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
IPADDR=11.11.11.80
NETMASK=255.0.0.0
HWADDR=00:0c:29:37:d0:44
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
 
   2.3 在兩個節點上分別重啟網路服務,使修改的IP生效。
[root@rac1 ~]#  service network restart
[root@rac2 ~]#  service network restart
 
 
三. 啟動crs, 設定oracle中ip地址相關的設定.
  3.1 在兩個節點啟動crs, 並關閉隨crs啟動的應用程式
[root@rac1 ~]# /etc/init.d/init.crs start
Startup will be queued to init within 30 seconds.

[root@rac2 ~]# /etc/init.d/init.crs start
Startup will be queued to init within 30 seconds.
由於oracle所有應用設定為自動啟動, 所以在crs啟動時會試圖啟動所有的服務, 但是在對oracle相關的ip地址進行設定時需要crs處於執行狀態. 但是資料庫, asm和node application處於停止狀態, 在一個節點執行以下命令:
[root@rac1 admin]# ./srvctl stop database -d orcl
[root@rac1 admin]# srvctl stop asm -n rac1
[root@rac1 admin]# srvctl stop asm -n rac2
[root@rac1 admin]# srvctl stop nodeapps -n rac1
[root@rac1 admin]# srvctl stop nodeapps -n rac2
 
[root@rac1 admin]# crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
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    OFFLINE   OFFLINE               
ora....C2.lsnr application    OFFLINE   OFFLINE               
ora.rac2.gsd   application    OFFLINE   OFFLINE               
ora.rac2.ons   application    OFFLINE   OFFLINE               
ora.rac2.vip   application    OFFLINE   OFFLINE 
 
3.2 使用oifcfg修改網路卡設定, oifconfig可以用來設定和檢視網路卡使用的方式.
注: 如果修改的網段相同,可以不做這一步。
 
-- 檢視當前配置:
[root@rac1 oracle]# oifcfg getif -global
eth0  192.168.72.0  global  public
eth1  10.0.0.0  global  cluster_interconnect

    -- 刪除當前配置
[root@rac1 oracle]# oifcfg delif -global eth0
[root@rac1 oracle]# oifcfg delif -global eth1
[root@rac1 oracle]# oifcfg getif
 
-- 重新新增
[root@rac1 oracle]# oifcfg setif -global eth0/192.168.72.0:public
[root@rac1 oracle]# oifcfg setif -global eth1/11.11.11.0:cluster_interconnect
[root@rac1 oracle]# oifcfg getif
eth0  10.85.10.0  global  public
eth1  192.168.1.0  global  cluster_interconnect
 
 
[root@rac1 oracle]# oifcfg iflist
eth0  192.168.72.0
eth1  11.0.0.0
 
       注意: 這裡IP 地址最一個為0.  代表的是一個網段。 修改的時候要切記。 否在在啟動OCR 時 會報如下錯誤:
       [  CRSOCR][4054413904] OCR context init failure.  Error: PROC-44: 網路地址和網路介面操作中出錯 網路地址和網路介面操作錯誤 [7]
 
 
 
    3.3 修改VIP
[root@rac1 oracle]# srvctl modify nodeapps -n rac1 -A 192.168.72.71/255.255.255.0/eth0
[root@rac1 oracle]# srvctl modify nodeapps -n rac2 -A 192.168.72.81/255.255.255.0/eth0
 
3.4 設定listener.ora和tnsnames.ora, 檢查這些檔案中是否有指定原來ip的地方, 修改為更改後的ip地址。
 
[root@rac1 admin]# more listener.ora
# listener.ora.rac1 Network Configuration File: /oracle/app/product/10.2.0/db_1/network/admi
n/listener.ora.rac1
# Generated by Oracle configuration tools.

LISTENER_RAC1 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521)(IP = FIRST))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.72.70)(PORT = 1521)(IP = FIRST))
    )
  )

SID_LIST_LISTENER_RAC1 =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /oracle/app/product/10.2.0/db_1)
      (PROGRAM = extproc)
    )
  )
注意:如果你使用了ocfs,修改ocfs配置檔案(/etc/ocfs/cluster.conf),驗證修改後是否可用。
 
3.5 啟動node applications, asm, 資料庫
[root@rac1 admin]# srvctl start nodeapps -n rac1
[root@rac1 admin]# srvctl start asm -n rac1
[root@rac1 admin]# srvctl start nodeapps -n rac2
[root@rac1 admin]# srvctl start asm -n rac2
 
[root@rac1 admin]# crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
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.6 確認IP, 修改完成。
    [root@rac1 ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:C8:3D:94  
          inet addr:192.168.72.70  Bcast:192.168.72.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fec8:3d94/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12391 errors:0 dropped:0 overruns:0 frame.:0
          TX packets:11582 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1418139 (1.3 MiB)  TX bytes:3174181 (3.0 MiB)
          Interrupt:185 Base address:0x14a4 

eth0:1    Link encap:Ethernet  HWaddr 00:0C:29:C8:3D:94  
          inet addr:192.168.72.71  Bcast:192.168.72.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:185 Base address:0x14a4 

eth1      Link encap:Ethernet  HWaddr 00:0C:29:C8:3D:9E  
          inet addr:11.11.11.70  Bcast:11.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::20c:29ff:fec8:3d9e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:17389 errors:0 dropped:0 overruns:0 frame.:0
          TX packets:22648 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:11236910 (10.7 MiB)  TX bytes:20717139 (19.7 MiB)
          Interrupt:193 Base address:0x1824 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:18883 errors:0 dropped:0 overruns:0 frame.:0
          TX packets:18883 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:4906716 (4.6 MiB)  TX bytes:4906716 (4.6 MiB)
[root@rac2 ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:37:D0:3A  
          inet addr:192.168.72.80  Bcast:192.168.72.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe37:d03a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5786 errors:0 dropped:0 overruns:0 frame.:0
          TX packets:5352 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:858615 (838.4 KiB)  TX bytes:889530 (868.6 KiB)
          Interrupt:185 Base address:0x1480 

eth0:1    Link encap:Ethernet  HWaddr 00:0C:29:37:D0:3A  
          inet addr:192.168.72.81  Bcast:192.168.72.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:37:D0:44  
          inet addr:11.11.11.80  Bcast:11.255.255.255  Mask:255.0.0.0
          inet6 addr: fe80::20c:29ff:fe37:d044/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:23167 errors:0 dropped:0 overruns:0 frame.:0
          TX packets:16865 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:20761783 (19.7 MiB)  TX bytes:11186923 (10.6 MiB)
          Interrupt:193 Base address:0x1800 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:14089 errors:0 dropped:0 overruns:0 frame.:0
          TX packets:14089 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:4515821 (4.3 MiB)  TX bytes:4515821 (4.3 MiB)

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23732248/viewspace-709056/,如需轉載,請註明出處,否則將追究法律責任。

相關文章