陈老师:1415968548 郑老师:2735197625 乐老师:354331153
客服热线:
19941464235 / 19906632509 / 19906733890 / 19905812933(微信同号)

客服微信

【Oracle】Oracle 19c RAC修改网络

作者:云贝学院
发布时间:2024-08-29 14:06
浏览量:917

注: 本文为云贝教育 刘峰 原创,请尊重知识产权,转发请注明出处,不接受任何抄袭、演绎和未经注明出处的转载。



变更目标

ip类型
节点
原IP
目标IP
PUBLIC IP
racdb01
192.168.2.60
192.168.2.160
racdb02
192.168.2.62
192.168.2.162
VIP
racdb01
192.168.2.61
192.168.2.161
racdb02
192.168.2.63
192.168.2.163




SCAN-IP
racdb01
racdb02
192.168.2.64
192.168.2.164

生产环境做变更,对核心文件需要进行备份

gpnp备份:

两个节点都要操作



cd $ORACLE_HOMEgpnp/profiles/peer/
cp profile.xml profile.xml.bak


修改任意IP前,需对/etc/hosts文件进行修改,不再赘述。



一、修改puclib ip

1.1 查看当前配置

[grid@racdb01 ~]$ oifcfg getif
ens33  192.168.2.0  global  public
ens36  10.10.10.0  global  cluster_interconnect,asm

1.2 查看当前网卡

ens38是我们新指定的PUBLIC网卡

一节点

ens38: flags=4163  mtu 1500
        inet 192.168.2.160  netmask 255.255.255.0  broadcast 192.168.2.255


二节点

ens38: flags=4163  mtu 1500
        inet 192.168.2.162  netmask 255.255.255.0  broadcast 192.168.2.255


1.3 删除原公网配置








oifcfg delif -global ens33/192.168.2.0


1.4 添加公网配置

示例 oifcfg setif -global <私有网卡名>/<新私有网段>:cluster_interconnect,asm

oifcfg setif -global ens38/192.168.2.0:public


1.5 检查

[grid@racdb01 ~]$ oifcfg getif
ens36  10.10.10.0  global  cluster_interconnect,asm
ens38  192.168.2.0  global  public


二、变更VIP

2.1 查看当前VIP配置

[grid@racdb02 ~]$ srvctl config nodeapps -a
Network 1 exists
Subnet IPv4: 192.168.2.0/255.255.255.0/ens33, 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 racdb01
VIP Name: racdb01-vip
VIP IPv4 Address: 192.168.2.61
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 racdb02
VIP Name: racdb02-vip
VIP IPv4 Address: 192.168.2.63
VIP IPv6 Address: 
VIP is enabled.
VIP is individually enabled on nodes: 
VIP is individually disabled on nodes: 



2.2 查看当前监听地址

[grid@racdb02 ~]$ lsnrctl  status
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.2.62)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.2.63)(PORT=1521)))
Services Summary...



2.3 关闭两节点上的VIP及监听

1)关闭两节点vip及监听
srvctl stop listener -n racdb01
srvctl stop vip -n racdb0
srvctl stop listener -n racdb02
srvctl stop vip -n racdb02
或
srvctl stop vip -n racdb01 -f
srvctl stop vip -n racdb02 -f


停掉vip之后,两个节点上的vip地址消失。

以二节点为例

[grid@racdb02 ~]$ ifconfig -a
ens33: flags=4163  mtu 1500
        inet 192.168.2.62  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::7abc:4983:ac14:e0dd  prefixlen 64  scopeid 0x20
        ether 00:0c:29:12:08:eb  txqueuelen 1000  (Ethernet)
        RX packets 1788  bytes 213310 (208.3 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1265  bytes 204969 (200.1 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens36: flags=4163  mtu 1500
        inet 10.10.10.38  netmask 255.255.255.0  broadcast 10.10.10.255


正常情况下

[oracle@racdb01 dbs]$ ifconfig -a
ens33: flags=4163  mtu 1500
        inet 192.168.2.60  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::a22b:7bcb:ba5b:566c  prefixlen 64  scopeid 0x20
        ether 00:0c:29:a5:2b:c7  txqueuelen 1000  (Ethernet)
        RX packets 1197951  bytes 1357345599 (1.2 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 35190  bytes 7038721 (6.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens33:1: flags=4163  mtu 1500
        inet 192.168.2.61  netmask 255.255.255.0  broadcast 192.168.2.255
        ether 00:0c:29:a5:2b:c7  txqueuelen 1000  (Ethernet)


2.4 根据VIP配置信息,修改VIP

格式: srvctl modify nodeapps -n  -A /255.255.255.0/<网卡>

cd /u01/app/19.3.0/grid/
bin/srvctl modify nodeapps -n racdb01 -A 192.168.2.161/255.255.255.0/ens33
bin/srvctl modify nodeapps -n racdb02 -A 192.168.2.163/255.255.255.0/ens33



2.5 修改/etc/hosts

两个节点改成以下信息

############Virtual IP############
192.168.2.161   racdb01-vip
192.168.2.163   racdb02-vip




2.6 验证VIP

srvctl config nodeapps -a

srvctl config vip -n racdb01
srvctl config vip -n racdb02

ip a


查看监听

lsnrctl status



三、变更SCAN-IP


3.1 关闭SCAN服务及监听

关闭scan监听
srvctl stop scan_listener
srvctl stop scan

查看
srvctl status scan_listener

3.2 修改/etc/hosts

两个节点均要操作

############Scan IP###############
192.168.2.164   racdb-scan


3.3 修改SCAN IP

格式srvctl modify scan -n 

srvctl modify scan -n racdb-scan

3.4 启动scan服务及监听

srvctl start scan_listener
srvctl start scan


3.5 检查

检查监听

[grid@racdb02 ~]$ lsnrctl  status listener_scan

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.2.164)(PORT=1521)))
Service "ORCL" has 1 instance(s).
  Instance "YBDBINST1", status READY, has 1 handler(s) for this service...
Service "yunnbeedXDB" has 1 instance(s).
  Instance "YBDBINST1", status READY, has 1 handler(s) for this service...


检查服务

[grid@racdb02 ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node racdb02



四、私网变更

变更类型:
1、配置双私网
2、变更当前私网IP

4.1 添加私网网卡

 oifcfg getif 

oifcfg setif -global ens38/10.10.20.0:cluster_interconnect

 oifcfg getif

实验1:关闭节点2上双私网中的一个,观察集群日志



4.2 变更私网

1、添加
oifcfg setif -global ens38/10.10.20.0:cluster_interconnect,asm

2、查看
[grid@racdb01 ~]$ oifcfg getif
ens36  10.10.10.0  global  cluster_interconnect,asm
ens39  192.168.2.0  global  public
ens38  10.10.20.0  global  cluster_interconnect,asm

3、加入一个新的 ASMLISTENE
srvctl add listener -asmlistener -l ASMNEWLSNR_ASM -subnet 10.10.20.0

4、查看当前的ASMLISNTER
[grid@racdb02 ~]$ srvctl status asmnetwork
ASM network is running on racdb02,racdb01

[grid@racdb01 ~]$ srvctl config asmnetwork
ASM network 1 exists
Subnet IPv4: 10.10.10.0//
Subnet IPv6: 
Network is enabled
Network is individually enabled on nodes: 
Network is individually disabled on nodes: 

[grid@racdb01 ~]$ srvctl config listener -asmlistener
Name: ASMNET1LSNR_ASM
Type: ASM Listener
Owner: grid
Subnet: 10.10.10.0
Home: 
End points: TCP:1525
Listener is enabled.
Listener is individually enabled on nodes: 
Listener is individually disabled on nodes:



5、删除现有的ASMLISTENER
[grid@racdb01 ~]$ srvctl update listener -listener ASMNET1LSNR_ASM -asm -remove -force  

lsnrctl stop ASMNET1LSNR_ASM 

6、查看
[grid@racdb01 ~]$ srvctl config  listener -asmlistener
Name: ASMNEWLSNR_ASM
Type: ASM Listener
Owner: grid
Subnet: 10.10.20.0
Home: 
End points: TCP:1526
Listener is enabled.
Listener is individually enabled on nodes: 
Listener is individually disabled on nodes: 



4.3 删除私网

 oifcfg delif -global ens38/10.10.20.0




想了解更多Oracle相关的学习资料(技术文章和视频),可以微信公众号或B站搜索《云贝教育》,免费获取。

想了解更多Oracle相关的学习资料(技术文章和视频),可以微信公众号或B站搜索《云贝教育》,免费获取。

想了解更多Oracle相关的学习资料(技术文章和视频),可以微信公众号或B站搜索《云贝教育》,免费获取。


另外需要学习资料的同学,可以添加联系方式:(同V) 陈老师 199-4146-4235 / 郑老师 199-0663-2509 / 蕾老师199-0663-5786,我们会持续更新学习视频。


相关视频:Oracle 19c RAC运维管理