当前位置: 首页 > news >正文

Oracle 11G RAC修改public ip vip private ip

1 修改目的

根据业务的需求,需要由原来的临时 IP改为生产 ip,以下为调整前后对应的IP表

调整前对应 ip 表:
192.168.210.241    rac1
192.168.210.242    rac2
192.168.210.245    rac1-vip
192.168.210.246    rac2-vip
11.11.11.1         rac1-priv
11.11.11.2         rac2-priv
192.168.210.247    rac-scan调整后对应IP列表:
192.168.210.235   rac1
192.168.210.236   rac2
192.168.210.237   rac1-vip
192.168.210.238   rac2-vip
192.168.210.239   rac-scan
11.10.10.1         rac1-priv
11.10.10.2         rac2-priv

2   修改 public ip,vip,scan vip

2.1  停止两边节点数据库,监听,并且停止 crs

srvctl stop database -d orcl -o immediate

grid 用户:

srvctl stop listener -n rac1

srvctl stop listener -n rac2

root 用户(双节点执行)

cd /oracle/grid/crs_2/bin

./crsctl stop crs

可以用 ps -ef|grep d.bin 看进程是否完全关闭

2.2  修改两边节点的/etc/hosts文件

修改前先做个备份

cp /etc/hosts /etc/hosts.bak

修改后如下所示:

192.168.210.235   rac1

192.168.210.236   rac2

192.168.210.237   rac1-vip

192.168.210.238   rac2-vip

192.168.210.239   rac-scan

11.11.11.1         rac1-priv

11.11.11.2         rac2-priv

注意这里私网 ip 地址暂时先不做修改,修改 private ip 时再修改

2.3  修改两个节点上的public ip,vip,scan vip

2.3.1 修改rac1 节点 public ip

vi /etc/sysconfig/network-scripts/ifcfg-eth0

IPADDR=192.168.210.235

GATEWAY=192.168.210.254

service network restart

2.3.2 修改rac2 节点 public ip

vi /etc/sysconfig/network-scripts/ifcfg-eth0

IPADDR=192.168.210.236

GATEWAY=192.168.210.254

service network restart

2.3.3 两边节点启动crs,一个节点 oifcfg 命令修改 public ip

cd /oracle/grid/crs_2/bin

./crsctl start crs

以下一个节点做即可

root 用户

先用 oifcfg getif 查看当前设置

[root@rac1 bin]# ./oifcfg getif

eth0  192.168.210.0  global  public

eth1  11.11.11.0  global  cluster_interconnect

修改

./oifcfg delif -global eth0

./oifcfg setif -global eth0/192.168.210.0:public      (改网段即可)

两边节点确认

./oifcfg getif

[root@rac1 bin]# ./oifcfg getif

eth1  11.11.11.0  global  cluster_interconnect

eth0  192.168.210.0  global  public

[root@rac2 bin]# ./oifcfg getif

eth1  11.11.11.0  global  cluster_interconnect

eth0  192.168.210.0  global  public

2.3.4 修改VIP  (如果是同一个网段的话,修改public ip 之后,vip会自己修改过来(从/etc/hosts中读取),不需要手工修改)

关闭 database 状态下操作

root 用户下运行以下命令

cd /oracle/grid/crs_2/bin

./srvctl stop database -d orcl -o immediate

grid 用户进行以下操作:

用 srvctl config vip 检查 vip 设置

[grid@rac1 ~]$ srvctl config vip -n rac1

VIP exists: /rac1-vip/192.168.210.237/192.168.210.0/255.255.255.0/eth0, hosting node rac1

[grid@rac1 ~]$ srvctl config vip -n rac2

VIP exists: /rac2-vip/192.168.210.238/192.168.210.0/255.255.255.0/eth0, hosting node rac2

停止 vip 服务和修改 vip

srvctl stop listener -n rac1

srvctl stop listener -n rac2

srvctl stop vip -n rac1

srvctl stop vip -n rac2

直接改就可以了

srvctl modify nodeapps -n rac1 -A rac1-vip/255.255.255.0/eth0

srvctl modify nodeapps -n rac2 -A rac2-vip/255.255.255.0/eth0

确认是否修改成功

srvctl config vip -n rac1

srvctl config vip -n rac2

启动 vip 服务

srvctl start vip -n rac1

srvctl start vip -n rac2

srvctl start listener -n rac1

srvctl start listener -n rac2

2.3.5 修改SCAN VIP

(1) srvctl config scan 查看当前 vip 设置

cd /oracle/grid/crs_2/bin

./srvctl config scan

(2) 用 root 用户停止 scan_listener 和 sacn vip

./srvctl stop scan_listener

./srvctl stop scan

./srvctl status scan

(3) 用 root 用户修改 scan vip

cd /oracle/grid/crs_2/bin

示例: ./srvctl modify scan -n scan-nam    (/etc/hosts 定义的scan ip的alias)

./srvctl modify scan -n rac-scan

(4) 检查是否修改成功

./srvctl config scan

SCAN name: rac-scan, Network: 1/192.168.210.0/255.255.255.0/eth0

SCAN VIP name: scan1, IP: /rac-scan/192.168.210.239  

(5) 启动 scan 和 scan_listener

./srvctl start scan

./srvctl start scan_listener

3  修改 private ip

 

双节点备份profile.xml

Please take a backup of profile.xml on all cluster nodes before proceeding, as grid user:

$ cd $GRID_HOME/gpnp/<hostname>/profiles/peer/

$ cp -p profile.xml profile.xml.bk

3.1  确保 crs集群是打开的

可以用 olsnodes -s 检查集群的状态

cd /oracle/grid/crs_2/bin

./olsnodes -s

rac1    Active

rac2    Active

3.2  用 oifcfg getif 检查和 oifcfg setif修改当前 private 设置

修改前设置

./oifcfg getif

eth1  11.11.11.0  global  cluster_interconnect

eth0  192.168.210.0  global  public

修改 private ip,新网络端口号为 eth1,如果没有修改端口号,则设置的值还是为eth1(这里修改网络端口号没变)

./oifcfg setif -global eth1/11.10.10.0:cluster_interconnect

./oifcfg delif -global ethxxxxxx (如果上面使用的是新的网卡号,则删除原来旧的网卡号)

修改后设置

./oifcfg getif

3.3  两边节点停止 crs (停止DB 和 crs 状态下操作的)

./crsctl stop crs

./crsctl disable crs

检查是否关闭

ps -ef|grep d.bin

3.4  修改两边节点/etc/hosts 表

11.11.11.1         rac1-priv

11.11.11.2         rac2-priv

修改为

11.10.10.1         rac1-priv

11.10.10.2         rac2-priv

3.5  修改 rac1 节点 private ip

vi /etc/sysconfig/network-scripts/ifcfg-eth1

IPADDR=11.10.10.1

service network restart

3.6  修改 rac2 节点 private ip

vi /etc/sysconfig/network-scripts/ifcfg-eth1

IPADDR=11.10.10.2

service network restart

3.7  两边节点启动 crs

./crsctl enable crs

./crsctl start crs

检查资源组状态

crs_stat -t

crsctl status resource -t

查看profile.xml

./gpnptool get

如果启动之后:

$ oifcfg delif -global <if_name>[/<subnet>]

eg:

$ oifcfg delif -global eth0/192.168.0.0

[root@rac1 bin]# ./oifcfg getif

eth0  192.168.210.0  global  public

eth1  11.10.10.0  global  cluster_interconnect

eth1  11.11.11.0  global  cluster_interconnect      (老的私网)

[root@rac1 bin]#  ./oifcfg delif -global eth1/11.11.11.0  (删除)

[root@rac1 bin]# ./oifcfg getif

eth0  192.168.210.0  global  public

eth1  11.10.10.0  global  cluster_interconnect

最后:

启动数据库:

srvctl start database -d orcl

两边节点修改local_listener 参数

how parameter local_listener

alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.210.237)(PORT=1521))))' scope=both sid='orcl1';

alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.210.238)(PORT=1521))))' scope=both sid='orcl2';

注:以上ip是vip

4  实施总结

1. 在修改 public ip 时注意修改对应的正确网关,如果不修改,有可能导致 vip服务起不来。

2. 注意检查修改 hosts 文件,因为改 ip 后,hosts 文件会增加记录。public ip 对应的掩码也要修改正确, 

3. 主机名在安装 crs 时要规划好,一旦装好后,就不能修改,否则要重新安装 crs。

4.  11GR2 srvctl 新增 config vip命令 

5. 修改private ip的顺序刚好和10gR2相反,10gR2是先关闭crs,然后修改hosts表和物理ip,再启动crs,用 oifcfg 设置新私网ip,这点要注意,否则按10gR2修改私网的方法,会导致CRS集群起不来,所以做之前先做好备份。

6. 如果两边节点 local_listener 参数没修改的话,会导致客户端连接不到数据库报 ERROR:ORA-12516: TNS: 监听程序找不到符合协议堆栈要求的可用处理程序,这是因为scan_listener 认到的还是修改前的vip

http://www.lryc.cn/news/573562.html

相关文章:

  • 【数据治理】要点整理-《数据管理能力成熟度评估模型》国家标准(GB/T 36073—2018)
  • Linux的文件权限
  • 16_设备树中的remote-endpoint演示基于视频字符设备Linux内核模块
  • python源码:执行pdf合并/分页/图片管理功能
  • 计算机网络课程设计--基于TCP协议的文件传输系统
  • 案例练习二
  • rom定制系列------红米note11 5G版 MTK芯片强解bl锁修复bug 官方系统 面具root批量线刷版
  • 魂斗罗ost 游戏全合集8GB
  • 微服务网关/nacos/feign总结
  • Mybatis-Plus支持多种数据库
  • 使用模板创建uniapp提示未关联uniCloud问题
  • LeapMotion-PhysicalHandsManager 类详解
  • 【后端】负载均衡
  • 怎么让二级域名绑定到wordpesss指定的页面
  • Linux系统基本操作指令
  • C++指针(二)
  • 【算法】【优选算法】优先级队列
  • 跨个体预训练与轻量化Transformer在手势识别中的应用:Bioformer
  • 告别线程爆炸:我如何用 Spring WebFlux 构建一个端到端响应式应用
  • 编程基础:调用访问
  • CSP-S 模拟赛一总结(T1、T2)
  • Odoo 17 Many2one字段内联编辑完整实现方案
  • 2025最新Python 100个常用函数在线体验项目
  • 微处理器原理与应用篇---计算机系统的性能测试
  • python中学物理实验模拟:凸透镜成像和凹透镜成像
  • Spring-MyBatis基本操作
  • 软件工程期末试卷简答题版带答案(共21道)
  • Typora文档另存与图片迁移的一种思路
  • JAVA锁机制:对象锁与类锁
  • 【好用但慎用】Windows 系统中将所有 WSL 发行版从 C 盘迁移到 非系统 盘的完整笔记(附 异常处理)