更改专用网络接口名称、子网或者网络掩码

注意:当网络掩码更改但子网 ID 不变时,例如网络掩码从 255.255.0.0 更改为 255.255.255.0,私有 IP 为 192.168.0.x,子网 ID 保持与 192.168.0.0 相同,网络接口名称未更改。
在需要更改的所有集群节点上关闭 Oracle Clusterware 堆栈,在 OS 层(例如:OS 网络配置等)为专用网络修改 IP,重新启动所有节点上的 Oracle Clusterware 堆栈将完成任务。
请注意,此更改不能以滚动方式进行。

当网络掩码更改时,关联的子网 ID 通常也会更改。
Oracle 只在 OCR 中存储网络接口名称和子网 ID,而不是网络掩码。
oifcfg 命令可用于此类更改,oifcfg 命令只需要在集群节点中的 1 个节点上运行,而不是所有节点。

对于 11gR2 之前的 Oracle 集群件

  1. 使用oifcfg添加新的私网信息,删除旧的私网信息:
% $ORA_CRS_HOME/bin/oifcfg/oifcfg setif -global [if_name]/[subnet]:cluster_interconnect
% $ORA_CRS_HOME/bin/oifcfg/oifcfg delif -global [if_name][/[subnet]]

例如:

% $ORA_CRS_HOME/bin/oifcfg setif -global [interfacename]3/192.168.2.0:cluster_interconnect
% $ORA_CRS_HOME/bin/oifcfg delif -global [interfacename]1/192.168.1.0

要验证更改:

% $ORA_CRS_HOME/bin/oifcfg getif  
eth0 10.X.XXX.0 global public
eth3 192.XXX.2.0 global cluster_interconnect
  1. 关闭 Oracle Clusterware 堆栈:

作为 root 用户:

# crsctl stop crs
  1. 在操作系统级别进行所需的网络更改,应在所有节点上修改 /etc/hosts 文件以反映更改。
    确保新网络在所有集群节点上可用:
% ping [private hostname/IP]
% ifconfig -a   ### on Unix/Linux

或者

% ipconfig /all   ### on windows
  1. 重新启动 Oracle Clusterware 堆栈:

作为 root 用户:

# crsctl start crs

注意:如果在 Linux 上运行 OCFS2,可能还需要更改 OCFS2 用于与其他节点通信的私有 IP 地址。

对于没有 Flex ASM 的 11gR2 Oracle Clusterware 和 12c Cluster

从 11.2 Grid Infrastructure 开始,私有网络配置不仅存储在 OCR 中,还存储在 gpnp 配置文件中。
如果专用网络不可用或者其定义不正确,则 CRSD 过程将不会启动,并且无法对 OCR 进行任何后续更改。
因此,在修改专用网络的配置时需要小心。
以正确的顺序执行更改很重要。
另请注意,不支持手动修改 gpnp 配置文件。

在继续之前,请以 grid 用户的身份在所有集群节点上备份 profile.xml:

$ cd $GRID_HOME/gpnp/[hostname]/profiles/peer/
$ cp -p profile.xml profile.xml.bk
  1. 确保 Oracle Clusterware 在集群中的所有集群节点上运行。

  2. 作为网格用户:

获取现有信息。
例如:

$ oifcfg getif
[interfacename]1 100.17.10.0 global public
[interfacename]0 192.168.0.0 global cluster_interconnect

添加新的 cluster_interconnect 信息:

$ oifcfg setif -global [interface]/[subnet]:cluster_interconnect

例如:
a)
添加具有相同子网的新接口 bond0。

$ oifcfg setif -global bond0/192.168.0.0:cluster_interconnect

湾添加具有相同接口名称但不同子网或者新接口名称的新子网:

$ oifcfg setif -global eth0/192.65.0.0:cluster_interconnect

或者

$ oifcfg setif -global eth3/192.168.1.96:cluster_interconnect

验证更改:

$ oifcfg getif
  1. 关闭所有节点上的 Oracle Clusterware 并以 root 用户身份禁用 Oracle Clusterware:
# crsctl stop crs
# crsctl disable crs
  1. 根据需要在 OS 级别更改网络配置,确保更改后新接口在所有节点上可用。
$ ifconfig -a
$ ping [private hostname]
  1. 在所有节点上以 root 用户启用 Oracle Clusterware 并重新启动 Oracle Clusterware:
# crsctl enable crs
# crsctl start crs
  1. 如果需要,移除旧接口:
$ oifcfg delif -global [interfacename][/[subnet]]

例如:

$ oifcfg delif -global eth0/192.168.0.0

对于具有 Flex ASM 的 12c 和 18c Oracle Clusterware

请查看上面的B部分并注意注意部分,备份如下:

在继续之前,请以 grid 用户的身份在所有集群节点上备份 profile.xml:

$ cd $GRID_HOME/gpnp/[hostname]/profiles/peer/
$ cp -p profile.xml profile.xml.bk
  1. 确保 Oracle Clusterware 在集群中的所有集群节点上运行。

  2. 作为网格用户:

获取现有信息。
例如:

$ oifcfg getif
[interfacename]1 100.17.10.0 global public
[interfacename]0 192.168.0.0 global cluster_interconnect,asm

上面的示例显示网络 eth0 用于 cluster_interconnect 和 ASM 网络。
添加新的 cluster_interconnect 信息:

$ oifcfg setif -global [interface]/[subnet]:cluster_interconnect[,asm]

例如:
a)
添加具有相同子网的新接口 bond0:

$ oifcfg setif -global bond0/192.168.0.0:cluster_interconnect,asm

湾添加具有相同接口名称但不同子网或者新接口名称的新子网:

$ oifcfg setif -global eth0/192.68.10.0:cluster_interconnect,asm

或者

$ oifcfg setif -global eth3/192.168.1.96:cluster_interconnect,asm

如果私有网络和ASM网络使用不同的网络,则相应地修改它们。

3、由于ASMLISTENER使用的是私网,修改私网会影响ASMLISTENER。
需要使用新的网络配置添加新的 ASMLISTENER。
如果 ASM 网络的子网未更改,请跳过此步骤。

添加具有新子网的新 ASMLISTENER(例如:ASMNEWLSNR_ASM),作为 grid 用户:

$ srvctl add  listener -asmlistener -l [new ASM LISTENER NAME] -subnet [new subnet]

例如:

$ srvctl add listener -asmlistener -l ASMNEWLSNR_ASM -subnet 192.168.10.0

删除现有的 ASMLISTENER(在本例中为 ASMLSNR_ASM)并删除依赖项,作为 grid 用户:

$ srvctl update listener -listener ASMLSNR_ASM -asm -remove -force
$ lsnrctl stop ASMLSNR_ASM

注意:-force 选项是必须的,否则会出现如下错误:

$ srvctl update listener -listener ASMLSNR_ASM -asm -remove
PRCR-1025 : Resource ora.ASMLSNR_ASM.lsnr is still running
$ srvctl stop listener -l ASMLSNR_ASM
PRCR-1065 : Failed to stop resource ora.ASMLSNR_ASM.lsnr
CRS-2529: Unable to act on 'ora.ASMLSNR_ASM.lsnr' because that would require stopping or relocating 'ora.asm', but the force option was not specified

验证配置:

$ srvctl config listener -asmlistener
$ srvctl config asm
  1. 关闭所有节点上的 Oracle Clusterware 并以 root 用户身份禁用 Oracle Clusterware:
# crsctl stop crs
# crsctl disable crs
  1. 根据需要在操作系统级别更改网络配置,确保更改后新接口在所有节点上可用。
$ ifconfig -a
$ ping [private hostname]
  1. 在所有节点上以 root 用户启用 Oracle Clusterware 并重新启动 Oracle Clusterware:
# crsctl enable crs
# crsctl start crs
  1. 如果需要,移除旧接口:
$ oifcfg delif -global [interfacename][/subnet]

例如:

$ oifcfg delif -global [interfacename]0/192.168.0.0

11gR2+ 的注意事项

  1. 如果底层网络配置已经改变,但没有运行oifcfg进行相同的改变,那么在Oracle Clusterware重启时,CRSD将无法启动。

crsd.log 将显示:

2010-01-30 09:22:47.234: [ default][2926461424] CRS Daemon Starting
..
2010-01-30 09:22:47.273: [ GPnP][2926461424]clsgpnp_Init: [at clsgpnp0.c:837] GPnP client pid=7153, tl=3, f=0
2010-01-30 09:22:47.282: [ OCRAPI][2926461424]clsu_get_private_ip_addresses: no ip addresses found.
2010-01-30 09:22:47.282: [GIPCXCPT][2926461424] gipcShutdownF: skipping shutdown, count 2, from [ clsinet.c : 1732], ret gipcretSuccess (0)
2010-01-30 09:22:47.283: [GIPCXCPT][2926461424] gipcShutdownF: skipping shutdown, count 1, from [ clsgpnp0.c : 1021], ret gipcretSuccess (0)
[ OCRAPI][2926461424]a_init_clsss: failed to call clsu_get_private_ip_addr (7)
2010-01-30 09:22:47.285: [ OCRAPI][2926461424]a_init:13!: Clusterware init unsuccessful : [44]
2010-01-30 09:22:47.285: [ CRSOCR][2926461424] OCR context init failure. Error: PROC-44: Error in network address and interface operations Network address and interface operations error [7]
2010-01-30 09:22:47.285: [ CRSD][2926461424][PANIC] CRSD exiting: Could not init OCR, code: 44
2010-01-30 09:22:47.285: [ CRSD][2926461424] Done.
Above errors indicate a mismatch between OS setting (oifcfg iflist) and gpnp profile setting profile.xml.

解决方法:将 OS 网络配置恢复到原始状态,启动 Oracle Clusterware。
然后按照上述步骤再次进行更改。
如果底层网络没有改变,但是 oifcfg setif 已经使用错误的子网地址或者接口名称运行,同样的问题也会发生。

  1. 如果集群中任一节点宕机,oifcfg 命令将失败并报错:
$ oifcfg setif -global bond0/192.168.0.0:cluster_interconnect
PRIF-26: Error in update the profiles in the cluster

解决方法:在未运行的节点上启动 Oracle Clusterware。
确保所有集群节点上的 Oracle Clusterware 都已启动。
如果节点由于任何操作系统原因关闭,请在执行专用网络更改之前从集群中删除节点。

  1. 如果 Grid Infrastructure 所有者以外的用户发出上述命令,它将失败并显示相同的错误:
$ oifcfg setif -global bond0/192.168.0.0:cluster_interconnect
PRIF-26: Error in update the profiles in the cluster

解决方法:确保以 Grid Infrastructure 所有者身份登录以执行此类命令。

  1. 从11.2.0.2开始,如果尝试删除最后一个私有接口(cluster_interconnect)而不先添加一个新接口,则会出现以下错误:
PRIF-31: Failed to delete the specified network interface because it is the last private interface

解决方法:先添加新的私有接口,然后再删除旧的私有接口。

  1. 如果节点上的 Oracle Clusterware 已关闭,则预期会出现以下错误:
$ oifcfg getif
PRIF-10: failed to initialize the cluster registry

解决方法:在节点上启动 Oracle Clusterware。

在Oracle RAC中如何更改专用网络接口名称、子网或者网络掩码

如果网络更改影响服务器,或者安装期间输入的原始信息不正确,则可能需要更改或者更新接口名称或者与接口关联的子网。
也可能是由于某种原因,Oracle Interface Configuration Assistant ('oifcfg') 在安装过程中没有成功。

Oracle Clusterware 的网络信息(接口、子网和每个接口的角色)由 'oifcfg' 管理,但每个接口的实际 IP 地址不是,'oifcfg' 无法更新 IP 地址信息。
'oifcfg getif' 可用于在 OCR 中找出当前配置的接口:

% $CRS_HOME/bin/oifcfg getif
[interfacename]0 10.X.XXX.0 global public
[interfacename]1 192.XXX.X.0 global cluster_interconnect

在 Unix/Linux 系统上,接口名称通常由操作系统分配,标准名称因平台而异。
对于 Windows 系统,请参阅下面的添加说明。
上例显示当前接口 [interfacename]0 用于子网为 10.2.156.0 的公共接口,[interfacename]1 用于子网为 192.168.0.0 的 cluster_interconnect/private。

“公共”网络用于数据库客户端通信(VIP 也使用相同的网络,尽管它作为单独的条目存储在 OCR 中),而“cluster_interconnect”网络用于 RDBMS/ASM 缓存融合。
从 11gR2 开始,cluster_interconnect 也用于集群件心跳,这是与之前版本相比的重大变化,因为 11gR2 之前的版本使用在安装时为集群件心跳指定的私有节点名。

如果'cluster_interconnect'接口的子网或者接口名称不正确,则需要更改为crs/grid用户。

配置文件用法

要查看 oifcfg 的完整选项,只需键入:

$ [CRS_HOME]/bin/oifcfg

使用 HAIP 添加或者删除 11gR2 及更高版本的 cluster_interconnect

  1. 使用 HAIP 将另一个私有网络添加到现有集群中,作为 grid 用户:
$ oifcfg setif -global [interface]/[subnet]:cluster_interconnect

例如:

$ oifcfg setif -global [interfacename]/192.XXX.XX.0:cluster_interconnect

关闭所有节点上的 CRS,然后重新启动所有节点上的 CRS,以便 HAIP 选择新接口。
以滚动方式重启CRS是不够的。

  1. 使用 HAIP 从集群中删除私有网络,作为 grid 用户:
$ oifcfg delif -global [interfacename]

例如:

$ oifcfg delif -global [interfacename]

HAIP 将故障转移到剩余的接口,并且集群件/数据库在接口移除后继续运行。
要删除另外的HAIP接口,需要在所有节点上关闭CRS,然后在所有节点上重新启动CRS。

查看更多教程 https://on  itroad.com

使用 oifcfg 更改接口名称的后果

对于私有接口,数据库将使用存储在 OCR 中并定义为“cluster_interconnect”的接口用于缓存融合流量。
cluster_interconnect 信息在启动时在警报日志中可用,在参数列表之后,例如:

对于 11.2.0.2 之前的版本:
集群通信配置为为此实例使用以下接口
192.XXX.X.1

对于 11.2.0.2+ :(HAIP 地址将显示在警报日志中而不是私有 IP)
集群通信配置为为此实例使用以下接口
169.XXX.XX.97

如果这是不正确的,那么一旦 OCR 条目被更正,实例就需要重新启动。
这同样适用于 ASM 实例和数据库实例。

日期:2020-09-17 00:11:39 来源:oir作者:oir