【RAC】OIFCFG 工具的使用

楊奇龍發表於2011-11-30
The Oracle Interface Configuration Tool(OIFCFG) command-line interface 命令列工具可以用來定義和管理網路卡資訊配置:
1 Allocate and deallocate network interfaces to components
2 Direct components to use specific network interfaces
3 Retrieve component configuration information
grid@rac1:/home/grid>oifcfg -h
Name:
        oifcfg - Oracle Interface Configuration Tool.
Usage:  oifcfg iflist [-p [-n]]
        -p: Displays a heuristic assumption of the interface type (PRIVATE, PUBLIC, or UNKNOWN)
        -n: Displays the netmask
        oifcfg setif {-node | -global} {/:}...
        oifcfg getif [-node | -global] [ -if [/] [-type ] ]
        oifcfg delif {{-node | -global} [[/]] [-force] | -force}
        oifcfg [-help]

-為通訊網路所知的主機名 /etc/hosts裡面的定義的hostname
- 系統中配置的介面的名稱 比如 eth0,eth1
 - 介面的子網地址
- 介面型別 { cluster_interconnect | public }
A network interface can be stored as a global interface (as reported by the iflist command) or as a node-specific interface:
An interface is stored as a global interface when all of the nodes of an Oracle Real Application Clusters (Oracle RAC) cluster have the same interface connected to the same subnet. The global interface (and configuring all nodes with the same network interface for each public subnet and the same network interface for each private subnet) is not only the recommended configuration, but it is also the default installation configuration.
An interface can be stored as a node-specific (local) interface.
Note:
oracle現在還不支援不同節點使用不同的網段。建議rac節點配置public ip和private ip時使用對應的相同的網段。
Oracle currently does not support having different network interfaces for each node in the cluster. 
The best practice is to configure all nodes with the same network interface for each public subnet and the same network interface for each private subnet.
getif檢視當前節點的網路卡配置屬性:
grid@rac1:/home/grid>oifcfg getif
網路卡名 子網               介面型別
eth0  10.250.7.0  global  public               公網ip
eth1  10.250.7.0  global  cluster_interconnect 私有ip
iflist顯示網路卡列表
grid@rac1:/home/grid>oifcfg iflist
eth0  10.250.7.0
eth1  10.250.7.0
eth1  169.254.0.0
grid@rac1:/home/grid>
setif 修改RAC的ip:
Note:
確保當使用setif 命令的時候,所有節點都是正常執行的,因為oracle 不能對down 機的節點的Grid Plug and Play profiles 進行更新
比如修改私有IP
grid@rac1:/home/grid>oifcfg setif -global  eth1/10.10.10.0:cluster_interconnect
grid@rac1:/home/grid>oifcfg getif
eth0  10.250.7.0  global  public
eth1  10.250.7.0  global  cluster_interconnect
eth1  10.10.10.0  global  cluster_interconnect
刪除私有ip
Note:
Use the oifcfg delif command to delete the stored configuration for global or node-specific interfaces. A specific node-specific or global interface can be deleted by supplying the interface name, with an optional subnet, on the command line.
Note:
如果執行不帶任何物件的oifcfg delif 命令,那麼 OIFCFG 叢集中所有的網路卡配置資訊(這個我就不做測試了)
grid@rac1:/home/grid>oifcfg delif -global eth1
PRIF-31: Failed to delete the specified network interface because it is the last private interface
解決辦法: Add new private interface first before deleting the old private interface.
對於重複的情況,要具體指定要刪除的私有ip
grid@rac1:/home/grid>oifcfg delif -global  eth1/10.250.7.0:cluster_interconnect   
grid@rac1:/home/grid>oifcfg getif 
eth0  10.250.7.0  global  public
eth1  10.10.10.0  global  cluster_interconnect
OIFCFG 使用注意事項:
1 Oracle Universal Installer使用OIFCFG來識別並顯示可用的網路卡。
2 修改網路卡名稱的影響視修改的型別(public,private)不同而不同,不論是否同時修改網路卡對應ip。 
  比如:In cases where you change only the interface names, the ramifications are minor. 
  如果要修改public型別的網路卡對應的name,注意此名稱儲存在OCR中,必須同時要修改所有節點中的nodeapps。因此必須重啟nodeapps以便修改生效
3 當使用global引數修改的時候,必須重啟叢集中的所有節點;對於本地的修改,則只要重啟本地節點就可以了。 
 Interconnect changes for the database occur at instance startup. However, the interconnect for Oracle Clusterware might be different.
4 因為內聯心跳是在例項啟動的時候被使用,在正在執行的系統上僅僅執行OIFCFG命令並不能立即生效。當且僅當受oifcfg 修改命令影響的元件重啟之後,修改生效。
5 對Clusterware層的變更,需要整個叢集處於正常執行狀態,因為oracle 不能對down 機的節點的Grid Plug and Play profiles 進行更新
crs 沒有起來的話會遇到:
grid@rac1:/home/grid>oifcfg getif
PRIF-10: failed to initialize the cluster registry

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

相關文章