10g下修改RAC地址

本測試是基於oracle 10.2.0.5

SQL*Plus: Release 10.2.0.5.0 - Production on Tue Jul 29 20:45:16 2014

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> 


首先來看一下,使用到的命令

[root@node1 bin]# ./oifcfg -help

Name:
	oifcfg - Oracle Interface Configuration Tool.

Usage:  oifcfg iflist [-p [-n]]
	oifcfg setif {-node <nodename> | -global} {<if_name>/<subnet>:<if_type>}...
	oifcfg getif [-node <nodename> | -global] [ -if <if_name>[/<subnet>] [-type <if_type>] ]
	oifcfg delif [-node <nodename> | -global] [<if_name>[/<subnet>]]
	oifcfg [-help]

	<nodename> - name of the host, as known to a communications network
	<if_name>  - name by which the interface is configured in the system
	<subnet>   - subnet address of the interface
	<if_type>  - type of the interface { cluster_interconnect | public | storage }

使用範例
查看網口信息
$ oifcfg iflist
ce0  172.25.0.0
ce0  172.25.198.0
ce1 10.0.0.0

查看私有網口信息
$ oifcfg iflist -p
ce0  172.25.0.0  PRIVATE
ce0  172.25.198.0  PRIVATE
ce1  10.0.0.0  PRIVATE

查看私有網口信息並顯示掩碼
$ oifcfg iflist -p -n
ce0  172.25.0.0  PRIVATE  255.255.0.0
ce0  172.25.198.0  PRIVATE  255.255.255.0
ce1  10.0.0.0  PRIVATE  255.255.255.0

查看當前節點的網口信息
$ oifcfg getif
eth0  192.168.0.0  global  cluster_interconnect
eth1  192.168.2.0  global  public
 
查看public類型的網卡

$ oifcfg getif -type public
eth1  192.168.2.0  global  public

查看eth0的網卡信息
$ oifcfg getif -if eth0
eth0  192.168.0.0  global  cluster_interconnect

查看node類型的配置信息,沒有輸出說明沒有配置node類型
$ oifcfg getif -node czmmiao1
$ oifcfg getif -node czmmiao2
 
刪除接口配置,需要切換到root用戶
# ./oifcfg delif–global 
添加接口配置,需要切換到root用戶

# ./oifcfg setif -global eth0/192.168.1.119:public

# ./oifcfg setif -global eth1/10.85.10.119:cluster_interconnect


修改RAC ip實例
RAC 修改IP 這個操作本身也只有幾步操作, 但是它涉及到OCR。 所以要格外小心。一般來說,如果不是必須要修改的話,儘量不要去修改OCR 的東西。 穩定第一。  在做之前,要手動的OCR 進行一個備份, 這樣即使修改失敗,也能還原回來。 OCR的備份。另外,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
修改 /etc/hosts 文件。 保持2個節點的一致
# 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
 
在兩個節點上分別修改eth0和eth1地址:
raw1
# 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

# 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


raw2
# 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

# 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
 
在兩個節點上分別重啓網絡服務,是修改的IP生效。
raw1,raw2
# service network restart 
啓動crs, 設置oracle中ip地址相關的設置.
在兩個節點啓動crs, 並關閉隨crs啓動的應用程序
# /etc/init.d/init.crs start
Startup will be queued to init within 90 seconds.
#  /etc/init.d/init.crs start
Startup will be queued to init within 90 seconds.
 
由於oracle所有應用設置爲自動啓動, 所以在crs啓動時會試圖啓動所有的服務, 但是在對oracle相關的ip地址進行設置時需要crs處於運行狀態. 但是數據庫, asm和node application處於停止狀態, 在一個節點執行以下命令:
# ./srvctl stop database -d raw
# ./srvctl stop asm -n raw1
# ./srvctl stop asm -n raw2
# ./srvctl stop nodeapps -n raw1
# ./srvctl stop nodeapps -n raw2
# ./crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.raw.db     application    OFFLINE   OFFLINE
ora.raw.dmm.cs application    OFFLINE   OFFLINE
ora....aw2.srv application    OFFLINE   OFFLINE
ora....w1.inst application    OFFLINE   OFFLINE
ora....w2.inst application    OFFLINE   OFFLINE
ora....SM1.asm application    OFFLINE   OFFLINE
ora....W1.lsnr application    OFFLINE   OFFLINE
ora.raw1.gsd   application    OFFLINE   OFFLINE
ora.raw1.ons   application    OFFLINE   OFFLINE
ora.raw1.vip   application    OFFLINE   OFFLINE
ora....SM2.asm application    OFFLINE   OFFLINE
ora....W2.lsnr application    OFFLINE   OFFLINE
ora.raw2.gsd   application    OFFLINE   OFFLINE
ora.raw2.ons   application    OFFLINE   OFFLINE
ora.raw2.vip   application    OFFLINE   OFFLINE
 
使用oifcfg修改網卡設置, oifconfig可以用來設置和查看網卡使用的方式.如果修改的網段相同,可以不做這一步。該操作只在一個節點上進行即可
-- 查看當前配置:
# ./oifcfg getif -global
eth0  10.85.10.0  global  public
eth1  192.168.1.0  global  cluster_interconnect
 
刪除當前配置
# ./oifcfg delif -global eth0
# ./oifcfg delif -global eth1
# ./oifcfg getif
 
重新添加
# ./oifcfg setif -global eth0/10.85.10.0:public
# ./oifcfg setif -global eth1/192.168.1.0:cluster_interconnect
# ./oifcfg getif
eth0  10.85.10.0  global  public
eth1  192.168.1.0  global  cluster_interconnect
 
# ./oifcfg iflist
eth0  192.168.86.0
eth1  192.168.0.0
eth2  192.168.200.0
eth3  192.168.200.0
eth4  192.168.200.0
eth5  192.168.200.0
 
注意: 這裏IP 地址最一個爲0.  代表的是一個網段。 修改的時候要切記。 否在在啓動OCR 時 會報如下錯誤:
[  CRSOCR][4054413904] OCR context init failure.  Error: PROC-44: 網絡地址和網絡接口操作中出錯 網絡地址和網絡接口操作錯誤 [7] 
修改VIP
# ./srvctl modify nodeapps -n raw1 -A 10.85.10.222/255.255.255.0/eth0
# ./srvctl modify nodeapps -n raw2 -A 10.85.10.223/255.255.255.0/eth0
 
設置listener.ora和tnsnames.ora, 檢查這些文件中是否有指定原來ip的地方, 修改爲更改後的ip地址。
# 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),驗證修改後是否可用。
啓動node applications, asm, 數據庫
# ./srvctl start nodeapps -n raw1                              
# ./srvctl start nodeapps -n raw2
# ./srvctl start asm -n raw1
# ./srvctl start asm -n raw2
# ./srvctl start instance -d raw -i raw1
# ./srvctl start instance -d raw -i raw2
# ./crs_stat -t
Name           Type           Target    State     Host
------------------------------------------------------------
ora.raw.db     application    ONLINE    ONLINE    raw2
ora.raw.dmm.cs application    ONLINE    ONLINE    raw2
ora....aw2.srv application    ONLINE    ONLINE    raw2
ora....w1.inst application    ONLINE    ONLINE    raw1
ora....w2.inst application    ONLINE    ONLINE    raw2
ora....SM1.asm application    ONLINE    ONLINE    raw1
ora....W1.lsnr application    ONLINE    ONLINE    raw1
ora.raw1.gsd   application    ONLINE    ONLINE    raw1
ora.raw1.ons   application    ONLINE    ONLINE    raw1
ora.raw1.vip   application    ONLINE    ONLINE    raw1
ora....SM2.asm application    ONLINE    ONLINE    raw2
ora....W2.lsnr application    ONLINE    ONLINE    raw2
ora.raw2.gsd   application    ONLINE    ONLINE    raw2
ora.raw2.ons   application    ONLINE    ONLINE    raw2
ora.raw2.vip   application    ONLINE    ONLINE    raw2
 
確認IP, 修改完成。
raw1
# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:55:28:FD
          inet addr:10.85.10.219  Bcast:10.85.10.255  Mask:255.255.255.0
          ... ...
eth0:1    Link encap:Ethernet  HWaddr 00:0C:29:55:28:FD
          inet addr:10.85.10.222  Bcast:10.85.10.255  Mask:255.255.255.0
         ... ...
eth1      Link encap:Ethernet  HWaddr 00:0C:29:55:28:07
          inet addr:192.168.1.219  Bcast:192.168.1.255  Mask:255.255.255.0
          ... ...
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
 
raw2          
# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:2E:28:EE
          inet addr:10.85.10.221  Bcast:10.85.10.255  Mask:255.255.255.0
  ... ...
eth0:1    Link encap:Ethernet  HWaddr 00:0C:29:2E:28:EE
          inet addr:10.85.10.223  Bcast:10.85.10.255  Mask:255.255.255.0
... ...
eth1      Link encap:Ethernet  HWaddr 00:0C:29:2E:28:F8
          inet addr:192.168.1.221  Bcast:192.168.1.255  Mask:255.255.255.0
... ...
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章