暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

oracle 11g RAC 修改 IP

yangweizhi 2024-08-16
59

oracle 11g RAC集群IP修改步骤:

1、操作系统:

CentOS 7.4

原IP信息:

#public IP

172.17.2.211 jq-hxdbt-211

172.17.2.212 jq-hxdbt-212

#private IP

172.17.5.211 jq-hxdbt-211-priv

172.17.5.212 jq-hxdbt-212-priv

#virtual IP:

172.17.2.213 jq-hxdbt-211-vip

172.17.2.214 jq-hxdbt-212-vip

#scan ip

172.17.2.215 hxdbscan

修改后:

#public IP

172.17.6.11 jq-hxdbt-11

172.17.6.12 jq-hxdbt-12

#private IP

172.17.7.213 jq-hxdbt-11-priv

172.17.7.214 jq-hxdbt-12-priv

#virtual IP:

172.17.6.13 jq-hxdbt-11-vip

172.17.6.14 jq-hxdbt-12-vip

#scan ip

172.17.6.15 hxdbscan

1、正常关闭数据库、监听和集群crs

这里先正常immediate关闭数据库,然后关闭监听,最后关闭两个节点的crs,这样再次启动crs时,就不会自动启动监听和数据库了。

节点1 grid执行即可。

[grid@jq-hxdbt-211 ~]$ srvctl stop database -d crmpos -o immediate

[grid@jq-hxdbt-211 ~]$ srvctl stop listener

[grid@jq-hxdbt-211 ~]$ which crsctl

/u01/app/11.2.0/grid/bin/crsctl

两个节点root都执行:

[root@jq-hxdbt-211 ~]# /u01/app/11.2.0/grid/bin/crsctl stop crs

[root@jq-hxdbt-212 ~]# /u01/app/11.2.0/grid/bin/crsctl stop crs

2.修改/etc/hosts配置文件

先备份原来的/etc/hosts文件为/etc/hosts.bak

[root@jq-hxdbt-211 ~]# cp /etc/hosts /etc/hosts.bak

[root@jq-hxdbt-212 ~]# cp /etc/hosts /etc/hosts.bak

然后再vi修改/etc/hosts文件:

将public ip、vip、scan vip修改为如下值:两个节点都改。

#public IP

172.17.6.11 jq-hxdbt-211

172.17.6.12 jq-hxdbt-212

#virtual IP:

172.17.6.13 jq-hxdbt-211-vip

172.17.6.14 jq-hxdbt-212-vip

#scan ip

172.17.6.15 hxdbscan

注意:其他内容不变。关于private ip,等后面单独修改private ip。

----------------

主机同学修改操作系统公有IP。修改网卡配置并重启。

-----------------

两个节点启动crscrsctl start crs

[root@jq-hxdbt-211 ~]# /u01/app/11.2.0/grid/bin/crsctl start crs

[root@jq-hxdbt-212 ~]# /u01/app/11.2.0/grid/bin/crsctl start crs

注意:这里如果是按照上面关闭crs的操作,正常数据库和监听是没有启动的,对应target和state都应该是offline。否则,得手工再关闭数据库和监听。

[root@jq-hxdbt-211 ~]# /u01/app/11.2.0/grid/bin/crsctl start crs

CRS-4123: Oracle High Availability Services has been started.

crsctl stat res -t 查看状态

开始修改IP

修改Public IP
查看当前设定,两个节点root用户执行,

1节点执行

[root@jq-hxdbt-211 ~]# /u01/app/11.2.0/grid/bin/oifcfg getif

eth0 172.17.2.0 global public

eth1 172.17.5.0 global cluster_interconnect

删除旧值并设定新值

[root@jq-hxdbt-211 ~]# /u01/app/11.2.0/grid/bin/oifcfg delif -global eth0

[root@jq-hxdbt-211 ~]# /u01/app/11.2.0/grid/bin/oifcfg setif -global eth0/172.17.6.0:public

--查看验证修改成功:

[root@jq-hxdbt-211 ~]# /u01/app/11.2.0/grid/bin/oifcfg getif

eth1 172.17.5.0 global cluster_interconnect

eth0 172.17.6.0 global public

二节点执行

[root@jq-hxdbt-212 ~]# /u01/app/11.2.0/grid/bin/oifcfg delif -global eth0

[root@jq-hxdbt-212 ~]# /u01/app/11.2.0/grid/bin/oifcfg setif -global eth0/172.17.6.0:public

[root@jq-hxdbt-212 ~]# /u01/app/11.2.0/grid/bin/oifcfg getif

eth1 172.17.5.0 global cluster_interconnect

eth0 172.17.6.0 global public

修改VIP
需要停止数据库、监听和VIP,如果按照之前操作,目前数据库和监听已经是停止状态。只需要停止vip即可。grid用户两节点执行即可。
[grid@jq-hxdbt-211 ~]$ srvctl stop vip -n jq-hxdbt-211

[grid@jq-hxdbt-212 ~]$ srvctl stop vip -n jq-hxdbt-212

查看状态

[grid@jq-hxdbt-211 ~]$ olsnodes -s

jq-hxdbt-211 Active

jq-hxdbt-212 Active

[grid@jq-hxdbt-211 ~]$ srvctl config vip -n jq-hxdbt-211

VIP exists.:jq-hxdbt-211

VIP exists.: /jq-hxdbt-211-vip/172.17.6.13/255.255.255.0/eth0

[grid@jq-hxdbt-211 ~]$ srvctl config vip -n jq-hxdbt-212

VIP exists.:jq-hxdbt-212

VIP exists.: /jq-hxdbt-212-vip/172.17.6.14/255.255.255.0/eth0

修改VIP设置:root用户执行

/u01/app/11.2.0/grid/bin/srvctl modify nodeapps -n jq-hxdbt-211 -A 172.17.6.13/255.255.255.0/eth0

/u01/app/11.2.0/grid/bin/srvctl modify nodeapps -n jq-hxdbt-212 -A 172.17.6.14/255.255.255.0/eth0

再次验证修改结果:

[grid@jq-hxdbt-211 ~]$ srvctl config vip -n jq-hxdbt-211

VIP exists.:jq-hxdbt-211

VIP exists.: /jq-hxdbt-211-vip/172.17.6.13/255.255.255.0/eth0

[root@jq-hxdbt-211 ~]# /u01/app/11.2.0/grid/bin/srvctl config vip -n jq-hxdbt-212

VIP exists.:jq-hxdbt-212

VIP exists.: /jq-hxdbt-212-vip/172.17.6.14/255.255.255.0/eth0

启动vip:grid用户执行:

[grid@jq-hxdbt-211 ~]$ srvctl start vip -n jq-hxdbt-211

[grid@jq-hxdbt-211 ~]$ srvctl start vip -n jq-hxdbt-212

Crsctl stat res -t检查状态已online

ora.jq-hxdbt-211.vip

ONLINE ONLINE jq-hxdbt-211

ora.jq-hxdbt-212.vip

ONLINE ONLINE jq-hxdbt-212

启动监听:

[grid@jq-hxdbt-211 ~]$ srvctl start listener

状态:online

ora.LISTENER.lsnr

ONLINE ONLINE jq-hxdbt-211

ONLINE ONLINE jq-hxdbt-212

启动数据库:

[grid@jq-hxdbt-211 ~]$ srvctl start database -d crmpos

查看状态:

ora.crmpos.db

ONLINE ONLINE jq-hxdbt-211 Open

ONLINE ONLINE jq-hxdbt-212 Open

确认local_listener信息:oralce用户登录数据库

SQL> show parameter listen

NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

listener_networks string

local_listener string (DESCRIPTION=(ADDRESS_LIST=(AD

DRESS=(PROTOCOL=TCP)(HOST=172.

17.2.213)(PORT=1521))))

remote_listener string hxdbscan:1521

地址还是原来的172.17.2.213。修改为新的IP172.17.6.13。

alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=172.17.6.13)(PORT=1521))' scope=both sid='crmpos1';

2节点修改为172.17.6.14

alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=172.17.6.14)(PORT=1521))' scope=both sid='crmpos2';

3 修改SCAN IP

查看SCAN VIP当前设置:grid用户

[grid@jq-hxdbt-211 ~]$ srvctl config scan

SCAN name: hxdbscan, Network: 1/172.17.6.0/255.255.255.0/eth0

SCAN VIP name: scan1, IP: /172.17.2.215/172.17.2.215

停止scan_listener和scan资源:

[grid@jq-hxdbt-211 ~]$ srvctl stop scan_listener

[grid@jq-hxdbt-211 ~]$ srvctl stop scan

[grid@jq-hxdbt-211 ~]$ srvctl status scan_listener

SCAN Listener LISTENER_SCAN1 is enabled

SCAN listener LISTENER_SCAN1 is not running

[grid@jq-hxdbt-211 ~]$ srvctl status scan

SCAN VIP scan1 is enabled

SCAN VIP scan1 is not running

[grid@jq-hxdbt-211 ~]$

使用root用户修改SCAN IP:节点1执行就可。

[root@jq-hxdbt-211 ~]# /u01/app/11.2.0/grid/bin/srvctl modify scan -n hxdbscan

修改并启动,grid用户执行:

[grid@jq-hxdbt-211 ~]$ srvctl modify scan_listener -u

[grid@jq-hxdbt-211 ~]$ srvctl start scan_listener

Crsctl stat res -t查看scan_listener和scan都已经启动:

ora.LISTENER_SCAN1.lsnr

1 ONLINE ONLINE jq-hxdbt-211

ora.scan1.vip

1 ONLINE ONLINE jq-hxdbt-211

再次确认信息修改成功:

[grid@jq-hxdbt-211 ~]$ srvctl config scan

SCAN name: hxdbscan, Network: 1/172.17.6.0/255.255.255.0/eth0

SCAN VIP name: scan1, IP: /hxdbscan/172.17.6.15

[grid@jq-hxdbt-211 ~]$ srvctl config scan_listener

SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521

查看整个集群状态正常:

[grid@jq-hxdbt-211 ~]$ crsctl stat res -t

--------------------------------------------------------------------------------

NAME TARGET STATE SERVER STATE_DETAILS

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.DATA.dg

ONLINE ONLINE jq-hxdbt-211

ONLINE ONLINE jq-hxdbt-212

ora.FRA.dg

ONLINE ONLINE jq-hxdbt-211

ONLINE ONLINE jq-hxdbt-212

ora.LISTENER.lsnr

ONLINE ONLINE jq-hxdbt-211

ONLINE ONLINE jq-hxdbt-212

ora.OCR.dg

ONLINE ONLINE jq-hxdbt-211

ONLINE ONLINE jq-hxdbt-212

ora.asm

ONLINE ONLINE jq-hxdbt-211 Started

ONLINE ONLINE jq-hxdbt-212 Started

ora.eons

ONLINE ONLINE jq-hxdbt-211

ONLINE ONLINE jq-hxdbt-212

ora.gsd

OFFLINE OFFLINE jq-hxdbt-211

OFFLINE OFFLINE jq-hxdbt-212

ora.net1.network

ONLINE ONLINE jq-hxdbt-211

ONLINE ONLINE jq-hxdbt-212

ora.ons

ONLINE ONLINE jq-hxdbt-211

ONLINE ONLINE jq-hxdbt-212

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.LISTENER_SCAN1.lsnr

1 ONLINE ONLINE jq-hxdbt-211

ora.crmpos.db

1 ONLINE ONLINE jq-hxdbt-211 Open

2 ONLINE ONLINE jq-hxdbt-212 Open

ora.jq-hxdbt-211.vip

1 ONLINE ONLINE jq-hxdbt-211

ora.jq-hxdbt-212.vip

1 ONLINE ONLINE jq-hxdbt-212

ora.oc4j

1 OFFLINE OFFLINE

ora.scan1.vip

1 ONLINE ONLINE jq-hxdbt-211

全部正常。

至此,修改Oracle 11g RAC的public IP、VIP、SCAN VIP就算完成了。通过plsql使用新的IP进行连接测试。6.11/12/13/14全部登录成功。

修改Private IP

因为Private IP不提供外部服务,可以不修改,这里仅进行测试一下。正式迁移时可规划好IP,不进行修改。

备份并确认CRS集群正常
从Oracle 11.2 GI开始,私有网络配置不仅仅存在ocr中,还存在gpnp profile中,所以首先需要备份profile.xml。

--节点1备份:grid用户执行

[grid@jq-hxdbt-211 peer]$ cd /u01/app/11.2.0/grid/gpnp//profiles/peer/

[grid@jq-hxdbt-211 peer]$ cp profile.xml profile.xml.bk

--节点2备份:

[grid@jq-hxdbt-212 peer]$ cd /u01/app/11.2.0/grid/gpnp//profiles/peer/

[grid@jq-hxdbt-212 peer]$ cp profile.xml profile.xml.bk

确认CRS集群在各节点启动:

[grid@jq-hxdbt-211 peer]$ olsnodes -s

jq-hxdbt-211 Active

jq-hxdbt-212 Active

增加一个新的私网信息:root用户执行:

查看:

[root@jq-hxdbt-211 ~]# /u01/app/11.2.0/grid/bin/oifcfg getif

eth1 172.17.5.0 global cluster_interconnect

eth0 172.17.6.0 global public

增加命令: 172.17.7.0,用以下命令:

/u01/app/11.2.0/grid/bin/oifcfg setif -global eth1/172.17.7.0:cluster_interconnect

再次查看:

[root@jq-hxdbt-211 ~]# /u01/app/11.2.0/grid/bin/oifcfg getif

eth1 172.17.5.0 global cluster_interconnect

eth0 172.17.6.0 global public

eth1 172.17.7.0 global cluster_interconnect

[root@jq-hxdbt-211 ~]#

Root用户在两个节点关闭并禁用集群

[root@jq-hxdbt-211 ~]# /u01/app/11.2.0/grid/bin/crsctl stop crs

[root@jq-hxdbt-212 ~]# /u01/app/11.2.0/grid/bin/crsctl stop crs

[root@jq-hxdbt-211 ~]# /u01/app/11.2.0/grid/bin/crsctl disable crs

[root@jq-hxdbt-212 ~]# /u01/app/11.2.0/grid/bin/crsctl disable crs

-----------------主机同学OS层修改私有网卡地址--

ifconfig -a

ping

修改私有网卡IP并重启:

vi /etc/hosts 修改private ip部分为:

#private IP

172.17.7.213 jq-hxdbt-211-priv

172.17.7.214 jq-hxdbt-212-priv

root用户在所有节点启用并启动集群

[root@jq-hxdbt-211 ~]# /u01/app/11.2.0/grid/bin/crsctl enable crs

[root@jq-hxdbt-212 ~]# /u01/app/11.2.0/grid/bin/crsctl enable crs

[root@jq-hxdbt-211 ~]# /u01/app/11.2.0/grid/bin/crsctl start crs

[root@jq-hxdbt-212 ~]# /u01/app/11.2.0/grid/bin/crsctl start crs

新增172.17.7.0,则删除原来的172.17.5.0

root执行
/u01/app/11.2.0/grid/bin/oifcfg delif -global eth1/172.17.5.0:cluster_interconnect
这里因为还是用的之前的网段,不需要操作。

验证集群状态以及登录数据库

Crsctl stat res -t

Plsql登录6.11/12/13/14/15

均正常,

至此,所有IP修改完毕。
————————————————

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/miqimile/article/details/140176458

文章转载自yangweizhi,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论