oracle rac修改IP地址测试

2023年 10月 17日 103.2k 0

1.禁止所有节点自动启动并关闭两边节点数据库、监听--一个节点执行
[root@rac1 bin]# ./srvctl disable database -d orcl
[root@rac1 bin]# ./srvctl stop database -d orcl -o immediate
[root@rac1 bin]# ./srvctl disable listener
[root@rac1 bin]# ./srvctl stop listener

2.禁止所有节点自动启动并停止VIP --一个节点执行
[root@rac2 ~]# srvctl disable vip -i rac1-vip
[root@rac2 ~]# srvctl disable vip -i rac2-vip
[root@rac2 ~]# srvctl stop vip -n rac1 -f
[root@rac2 ~]# srvctl stop vip -n rac2

3.禁止所有节点的SCAN和SCAN_LISTENER的启动,停止所有节点的SCAN和SCAN_LISTENER--一个节点执行
[root@rac2 ~]# srvctl disable scan_listener
[root@rac2 ~]# srvctl stop scan_listener
[root@rac2 ~]# srvctl disable scan
[root@rac2 ~]# srvctl stop scan

4.停止crs--一个节点执行
[root@rac2 ~]# crsctl stop cluster -all

5.修改hosts文件和网卡ip配置--双节点执行
[root@rac1 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.9.131 rac1
192.168.9.132 rac2
2.0.9.31 rac1-pri
2.0.9.32 rac2-pri
192.168.9.133 rac1-vip
192.168.9.134 rac2-vip
192.168.9.139 rac-scan

[root@rac1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens160
[root@rac2 ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens160
重启网卡:
[root@rac1 network-scripts]# nmcli c reload
[root@rac1 network-scripts]# nmcli c up ens224

6.启动crs--一个节点执行
[root@rac2 ~]# crsctl start cluster -all

7.修改集群的public IP --双节点执行
[root@rac1 ~]# oifcfg getif
ens160 192.168.9.0 global public
ens192 2.0.9.0 global cluster_interconnect,asm

[root@rac2 ~]# oifcfg getif
ens160 192.168.9.0 global public
ens192 2.0.9.0 global cluster_interconnect,asm
--我这测试是相同网段,如果不同网段需要删除重新添加以下:
[root@rac2 ~]# oifcfg delif -global ens160
[root@rac2 ~]# oifcfg getif
ens192 2.0.9.0 global cluster_interconnect,asm
[root@rac2 ~]# oifcfg setif -global ens160/192.168.9.0:public
[root@rac2 ~]# oifcfg getif
ens192 2.0.9.0 global cluster_interconnect,asm
ens160 192.168.9.0 global public

8.修改集群的VIP和SCAN_IP
[root@rac1 ~]# srvctl config vip -n rac1
VIP exists: network number 1, hosting node rac1
VIP Name: rac1-vip
VIP IPv4 Address: 192.168.9.133
VIP IPv6 Address:
VIP is disabled.
VIP is individually enabled on nodes:
VIP is individually disabled on nodes:
[root@rac1 ~]# srvctl config vip -n rac2
VIP exists: network number 1, hosting node rac2
VIP Name: rac2-vip
VIP IPv4 Address: 192.168.9.134
VIP IPv6 Address:
VIP is disabled.
VIP is individually enabled on nodes:
VIP is individually disabled on nodes:
#此时还没正式修改VIP,但是查看vip配置时集群显示已经是更新之后的地址:
[root@rac1 ~]# srvctl config nodeapps -a
Network 1 exists
Subnet IPv4: 192.168.9.0/255.255.255.0/ens160, 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 rac1
VIP Name: rac1-vip
VIP IPv4 Address: 192.168.9.133
VIP IPv6 Address:
VIP is disabled.
VIP is individually enabled on nodes:
VIP is individually disabled on nodes:
VIP exists: network number 1, hosting node rac2
VIP Name: rac2-vip
VIP IPv4 Address: 192.168.9.134
VIP IPv6 Address:
VIP is disabled.
VIP is individually enabled on nodes:
VIP is individually disabled on nodes:

--不同网段更新需执行以下,不然修改不了scan ip:
[root@rac1 ~]# srvctl modify nodeapps -n rac1 -A 192.168.9.133/255.255.255.0/ens160
[root@rac1 ~]# srvctl modify nodeapps -n rac2 -A 192.168.9.134/255.255.255.0/ens160

9.修改scan ip
[root@rac1 ~]# srvctl config scan
SCAN name: rac-scan, Network: 1
Subnet IPv4: 192.168.9.0/255.255.255.0/ens160, static
Subnet IPv6:
SCAN 1 IPv4 VIP: 192.168.9.39
SCAN VIP is disabled.
[root@rac1 ~]# srvctl modify scan -n 192.168.9.139

10.启动监听和各服务
srvctl enable listener
srvctl enable vip -i rac1-vip
srvctl enable vip -i rac2-vip
srvctl enable scan_listener
srvctl enable scan
srvctl enable database -d orcl
srvctl start listener
srvctl start vip -n rac1 --会自动启动,不用执行
srvctl start scan --会自动启动,不用执行
srvctl start scan_listener --会自动启动,不用执行
srvctl start database -d orcl
#集群状态
[grid@db2:/home/grid]$ crsctl stat res -t

完成

相关文章

Oracle如何使用授予和撤销权限的语法和示例
Awesome Project: 探索 MatrixOrigin 云原生分布式数据库
下载丨66页PDF,云和恩墨技术通讯(2024年7月刊)
社区版oceanbase安装
Oracle 导出CSV工具-sqluldr2
ETL数据集成丨快速将MySQL数据迁移至Doris数据库

发布评论