ORACLE 12C 修改VIP SCANIP
Table of Contents
1 目标确认
首先要确定要改哪些IP,要改成什么
-
修改前的IP
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 # oracle public ip 192.168.1.14 halberd2 192.168.1.13 halberd1 #oracle vip 192.168.1.4 halberd1-vip 192.168.1.5 halberd2-vip # oracle priv-ip 172.26.9.30 halberd1-priv 172.26.9.31 halberd2-priv # scan ip 192.168.1.6 racscan 192.168.1.7 racscan
-
修改后的IP
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 # oracle public ip 192.168.1.14 halberd2 192.168.1.13 halberd1 #oracle vip 192.168.1.6 halberd1-vip 192.168.1.7 halberd2-vip # oracle priv-ip 172.26.9.30 halberd1-priv 172.26.9.31 halberd2-priv # scan ip 192.168.1.4 racscan 192.168.1.5 racscan
2 查看集群信息
root 用户执行
export ORACLE_HOME=/g01/app/12.2.0 export PATH=$PATH:$ORACLE_HOME/bin oifcfg getif eno1 192.168.1.0 global public eno3 172.26.9.0 global cluster_interconnect,asm srvctl config nodeapps -a Network 1 exists Subnet IPv4: 192.168.1.0/255.255.255.224/eno1, static Subnet IPv6: Ping Targets: Network is enabled Network is individually enabled on nodes: Network is individually disabled on nodes: VIP exists: network number 1, hosting node halberd1 VIP Name: halberd1-vip VIP IPv4 Address: 192.168.1.4 VIP IPv6 Address: VIP is enabled. VIP is individually enabled on nodes: VIP is individually disabled on nodes: VIP exists: network number 1, hosting node halberd2 VIP Name: halberd2-vip VIP IPv4 Address: 192.168.1.5 VIP IPv6 Address: VIP is enabled. VIP is individually enabled on nodes: VIP is individually disabled on nodes: srvctl config scan SCAN name: racscan, Network: 1 Subnet IPv4: 192.168.1.0/255.255.255.224/eno1, static Subnet IPv6: SCAN 1 IPv4 VIP: 192.168.1.6 SCAN VIP is enabled. SCAN VIP is individually enabled on nodes: SCAN VIP is individually disabled on nodes: SCAN 2 IPv4 VIP: 192.168.1.7 SCAN VIP is enabled. SCAN VIP is individually enabled on nodes: SCAN VIP is individually disabled on nodes:
3 *备份OCR
修改前先备份ocr(2台主机都备份)
ocrconfig -export /home/grid/myocr PROT-58: successfully exported the Oracle Cluster Registry contents to file ‘/home/grid/myocr‘
4 修改ocr信息
4.1 修改网段
只有原IP与目标IP不在一个网段时才需要操作。 本次示例并不需要修改网段,因此下面只是一个示例。
# 删除原有网段配置 oifcfg delif -global eno1/192.168.1.0 # 添加新的网段配置 oifcfg setif -global en8/192.168.2.0:public
修改完,使用下面命令查看是否修改成功 oifcfg getif
4.2 停止SCAN相关
因为本次操作,实际上是VIP 与 SCANIP 对换,因此要停止SCAN相关。
srvctl stop scan_listener PRCC-1016 : LISTENER_SCAN1 was already stopped PRCR-1005 : Resource ora.LISTENER_SCAN1.lsnr is already stopped PRCC-1016 : LISTENER_SCAN2 was already stopped PRCR-1005 : Resource ora.LISTENER_SCAN2.lsnr is already stopped srvctl stop scan srvctl status scan SCAN VIP scan1 is enabled SCAN VIP scan1 is not running SCAN VIP scan2 is enabled SCAN VIP scan2 is not running
4.3 修改vip
# 停止 VIP srvctl stop vip -n halberd1 -f srvctl stop vip -n halberd2 -f # 修改VIP srvctl modify nodeapps -n halberd1 -A 192.168.1.6/255.255.255.224/eno1 srvctl modify nodeapps -n halberd2 -A 192.168.1.7/255.255.255.224/eno1 # 查看VIP 修改结果 srvctl config nodeapps -a # 启动VIP srvctl start vip -n halberd1 srvctl start vip -n halberd2
4.4 修改scanip
srvctl modify scan -n racscan srvctl modify scan_listener -u # 启动scan 和scan监听 srvctl start scan srvctl start scan_listener # 检查SCAN-VIP TYPE crsctl status res -w "TYPE = ora.scan_vip.type" -p|egrep ‘^NAME|^SCAN_NAME|^USR_ORA_VIP‘ NAME=ora.scan1.vip SCAN_NAME=racscan ==> scan_name 对应的IP别名或者域名 USR_ORA_VIP=192.168.1.4 NAME=ora.scan2.vip SCAN_NAME=racscan USR_ORA_VIP=192.168.1.5
如果scan_name 和vip 地址不对的话,使用下面命令修改
crsctl modify type ora.scan_vip.type -attr "ATTRIBUTE=SCAN_NAME,DEFAULT_VALUE=racscan"