oracle11Grac环境下修改IP地址
查看当前设置,以便保存现有设置。
以grid用户执行:$ORACLE_HOME/bin/oifcfggetif
[grid@orcl1 ~]$ /u01/app/grid/11.2.0/dbhome_1/bin/oifcfg getif
ens33 192.168.133.0 global public
ens38 10.10.1.0 global cluster_interconnect
查看当前VIP网段及所使用的网卡设备:
[grid@orcl1 ~]$ srvctl config nodeapps -a
Network exists: 1/192.168.133.0/255.255.255.0/ens33, type static
VIP exists: /orcl1-vip/192.168.133.114/192.168.133.0/255.255.255.0/ens33, hosting node orcl1
VIP exists: /orcl2-vip/192.168.133.115/192.168.133.0/255.255.255.0/ens33, hosting node orcl2
查看VIP资源状态:
[grid@orcl1 ~]$ crsctl stat res ora.orcl1.vip
NAME=ora.orcl1.vip
TYPE=ora.cluster_vip_net1.type
TARGET=ONLINE
STATE=ONLINE on orcl1
[grid@orcl2 ~]$ crsctl stat res ora.orcl2.vip
NAME=ora.orcl2.vip
TYPE=ora.cluster_vip_net1.type
TARGET=ONLINE
STATE=ONLINE on orcl2
停掉监听及VIP资源
srvctl stop listener -n orcl1
srvctl stop vip -n orcl1 -f
停掉后,再次使用crsctl stat res命令查看资源状态
注:此步可以分节点操作,也可是两个节点同时操作,取决于停机时间。建议两个节点同时操作,否则的话,在最后割接完成后,很可能会出现两个节点连接数不均衡的问题。另外,为了避免引起不必要的麻烦,且停机时间充足的情况下,建议(非必须)停掉数据库:
$ srvctl stop instance -d orcl -n orcl1
$ srvctl stop instance -d orcl -n orcl2
备份profile.xml文件
在两个点节点中,以grid用户执行:
cd /u01/app/grid/11.2.0/dbhome_1/gpnp/racdb1/profiles/peer
cp -p profile.xml profile.xml.bak
停掉并禁用CRS
在两个节点上以root用户停掉crs,并disable掉crs:
/u01/app/grid/11.2.0/dbhome_1/bin/crsctl stop crs
/u01/app/grid/11.2.0/dbhome_1/bin/crsctl disable crs
在操作系统上完成网络相关更改
完成操作系统上相关的网络更改,主要包括:
1、IP地址变更。
2、/etc/hosts文件变更:
/etc/hosts文件原内容:
[root@orcl1 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#public ip
192.168.133.104 orcl1
192.168.133.105 orcl2
#priv ip
10.10.1.14 orcl1-priv
10.10.1.15 orcl2-priv
#vip ip
192.168.133.114 orcl1-vip
192.168.133.115 orcl2-vip
#scan ip
192.168.133.106 orcl-scan
/etc/hosts修改后内容:
[root@orcl1 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#public ip
192.168.133.154 orcl1
192.168.133.155 orcl2
#priv ip
10.10.1.14 orcl1-priv
10.10.1.15 orcl2-priv
#vip ip
192.168.133.164 orcl1-vip
192.168.133.165 orcl2-vip
#scan ip
192.168.133.166 orcl-scan
在确保主机上已经完成所有的网络相关的更改操作,并且新的私有网络已经运行正常时,启用并启动CRS。
修改VIP设置并启动VIP及监听资源
在任意节点上以root用户执行:
[root@orcl1 ~]# /u01/app/grid/11.2.0/dbhome_1/bin/srvctl modify nodeapps -n orcl1 -A racdb1-vip/255.255.255.0
在两个节点上进行检查,看是否可以看到新的VIP设置:
[grid@orcl1 ~]$ srvctl config nodeapps -a
Network exists: 1/192.168.133.0/255.255.255.0/ens33, type static
VIP exists: /orcl1-vip/192.168.133.164/192.168.133.0/255.255.255.0/ens33, hosting node orcl1
VIP exists: /orcl2-vip/192.168.133.165/192.168.133.0/255.255.255.0/ens33, hosting node orcl2
在任意节点上以grid用户启动VIP及监听资源:
$ srvctl start vip -n orcl1
$ srvctl start vip -n orcl2
$ srvctl start listener -n orcl1
$ srvctl start listener -n orcl2
如果此前停掉了数据库,则此时也启动数据库,也是以grid用户执行:
$ srvctl start instance -d orcl -n orcl1
$ srvctl start instance -d orcl -n orcl2
更改SCAN IP地址
1.先修改两个节点的/etc/hosts文件中的scan ip信息
将
#scan ip
192.168.133.106 orcl-scan
改为
#scan ip
192.168.133.166 orcl-scan
2.查看当前SCAN配置:
[grid@orcl1 ~]$ srvctl config scan
SCAN name: orcl-scan, Network: 1/192.168.133.0/255.255.255.0/ens33
SCAN VIP name: scan1, IP: /orcl-scan/192.168.133.106
3.停掉SCAN 监听:
[grid@orcl1 ~]$ srvctl stop scan_listener
4.停掉SCAN IP资源,也就是停掉SCAN IP:
[grid@orcl1 ~]$ srvctl stop scan
5.以root用户修改scan设置:
[root@orcl1 ~]# /u01/app/grid/11.2.0/dbhome_1/bin/srvctl modify scan -n orcl-scan
6.以grid用户在两个节点上执行命令,看是否修改成功:
[grid@orcl1 ~]$ srvctl config scan
SCAN name: orcl-scan, Network: 1/192.168.133.0/255.255.255.0/ens33
SCAN VIP name: scan1, IP: /orcl-scan/192.168.133.166
7.启动scan ip资源及scan监听:
[grid@orcl1 ~]$ srvctl start scan
[grid@orcl1 ~]$ srvctl start scan_listener
8.查看scan ip及scan 监听资源状态:
[grid@orcl1 ~]$ srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node orcl2
[grid@orcl1 ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node orcl2
[grid@orcl1 ~]$ crsctl stat res ora.scan1.vip ora.LISTENER_SCAN1.lsnr
NAME=ora.LISTENER_SCAN1.lsnr
TYPE=ora.scan_listener.type
TARGET=ONLINE
STATE=ONLINE on orcl2
NAME=ora.scan1.vip
TYPE=ora.scan_vip.type
TARGET=ONLINE
STATE=ONLINE on orcl2
启用并启动CRS
以root用户在两个节点上启用并启动crs:
/u01/app/grid/11.2.0/dbhome_1/bin/crsctl enable crs
/u01/app/grid/11.2.0/dbhome_1/bin/crsctl start crs
注:此时,可以分节点执行,在一个节点的CRS启动成功后,再启动另一个节点的CRS。
疫情期间思庄学习中心继续在线上课模式,从此开启思庄Linux、Oracle等专业技术人才“高特在线营”!! 更多上课详情请访问思庄网站咨询在线课程老师,谢谢!
以上是 oracle11Grac环境下修改IP地址 的全部内容, 来源链接: utcz.com/z/532282.html