11gr2rac 修改ip地址

oracle 11g rac 修改IP

今天在一套RAC上修改了IP。包括pub,vip,scan5个IP。借鉴的文档如下:

11GR2 RAC modify vip,public ip,private ip,scan vip
实施步骤
1 修改目的
根据业务的需求,需要由原来的临时IP改为生产ip,以下为调整前后对应的IP表
调整前对应ip表

主机名          类型         IP 地址         网卡端口

P570a    public ip   192.168.128.10  en0

p570a-vip vip         192.168.128.12  en0

p570a-priv private ip 172.168.128.10 en2

p570b    public ip   192.168.128.11 en0

p570b-vip  vip        192.168.128.13  en0

p570b-priv private ip  172.168.128.11 en2

scan-vip scan  192.168.128.100  en0

调整后对应ip表

主机名      类型       IP 地址     网卡端口

P570a  public ip   10.76.31.112  en0

p570a-vip   vip  10.76.31.113     en0

p570a-priv  private ip  192.76.31.113  en8

p570b  public ip  10.76.31.114   en0

p570b-vip  vip   10.76.31.115   en0

p570b-priv  private ip  192.76.31.115  en8

scan-vip   scan    10.76.31.111  en0

网卡端口可以用ifconfig -a 显示出来

2 修改public ip,vip,scan vip

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

grid用户

srvctl stop database -d gdcdc -o immediate

srvctl stop listener -n p570a

srvctl stop listener -n p570b

root用户

cd /grid/app/11.2.0/grid/bin

./crsctl stop crs

可以用ps –ef|grep grid看进程是否完全关闭

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

修改前先做个备份

cp /etc/hosts /etc/hosts.bak

修改后如下所示:

10.76.31.112 p570a

10.76.31.113 p570a-vip

172.168.128.10 p570a-priv

10.76.31.114 p570b

10.76.31.115 p570b-vip

172.168.128.11 p570b-priv

10.76.31.111 scan-vip

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

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

2.3.1修改p570a节点 public ip

用smitty命令修改物理ip

smitty tcpip

选择en0

修改ip为 10.76.31.112,网关为10.76.31.1

掩码为 255.255.255.0

2.3.2修改P570b节点 public ip

用smitty命令修改物理ip

smitty tcpip

选择en0

修改ip为 10.76.31.114,网关为10.76.31.1

掩码为255.255.255.0

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

一边节点做即可

cd /grid/app/11.2.0/grid/bin

./crsctl start crs

root用户

先用oifcfg getif查看当前设置

./oifcfg getif

en0 192.168.128.0 global public

en2 172.168.128.0 global cluster_interconnect

修改

./oifcfg delif -global en0

./oifcfg setif -global en0/10.76.31.0:public

两边节点确认

./oifcfg getif

en0 10.76.31.0 global public

en2 172.168.128.0 global cluster_interconnect

2.3.4修改VIP

关闭database

root用户下运行以下命令

cd /grid/app/11.2.0/grid/bin

./srvctl stop database -d gdcdc -o immediate

用srvctl config vip 检查vip设置

$ srvctl config vip -n p570a

VIP exists.:p570a

VIP exists.: /p570a-vip/192.168.128.12/255.255.255.0/eth0

$ srvctl config vip -n p570b

VIP exists.:p570b

VIP exists.: /p570b-vip/192.168.128.13/255.255.255.0/eth0

停止vip 服务和修改vip

./srvctl stop listener -n p570a

./srvctl stop listener -n p570b

./srvctl stop vip -n p570a

./srvctl stop vip -n p570b

./srvctl modify nodeapps -n p570a -A 10.76.31.113/255.255.255.0/en0

./srvctl modify nodeapps -n p570b -A 10.76.31.115/255.255.255.0/en0

确认是否修改成功

./srvctl config vip -n p570a

VIP exists.:p570a

VIP exists.:/p570a-vip/10.76.31.113/255.255.255.0/en0

./srvctl config vip -n p570b

VIP exists.:p570b

VIP exists.:/p570b-vip/10.76.31.115/255.255.255.0/en0

启动vip服务,监听,数据

./srvctl start vip -n p570a

./srvctl start vip -n p570b

./srvctl start listener -n p570a

./srvctl start listener -n p570b

./srvctl start database –d gdcdc

2.3.5 两边节点修改local_listener参数

Show parameter local_listener

NAME TYPE VALUE

———————————— ———– ——————————

local_listener string (DESCRIPTION=(ADDRESS_LIST=(AD

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

168.128.12)(PORT=1521))))

alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.76.31.113)(PORT=1521))))’ scope=both sid=’gdcdc1′;

alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.76.31.115)(PORT=1521))))’ scope=both sid=’gdcdc2′; 第6页共11页

2.3.6修改SCAN VIP

1.srvctl config scan 查看当前vip设置

config scan SCAN name: 192.168.128.100, Network: 1/192.168.128.0/255.255.255.0/en0 SCAN VIP name: scan1, IP: /scan-vip/192.168.128.100

2.用root用户停止scan_listener 和sacn vip

$GRID_HOME/bin/srvctl stop scan_listener $GRID_HOME/bin/srvctl stop scan $GRID_HOME/bin/srvctl status scan

SCAN VIP scan1 is enabled SCAN VIP scan1 is not running

$GRID_HOME/bin/srvctl status scan_listener SCAN Listener LISTENER_SCAN1 is enabled SCAN listener LISTENER_SCAN1 is not running

3.用root用户修改scan vip

$GRID_HOME/bin/srvctl modify scan -n10.76.31.111

4.检查是否修改成功

config scan SCAN name: 10.76.31.111 , Network: 1/10.76.31.0/255.255.255.0/en0 SCAN VIP name: scan1, IP: /scan-vip/10.76.31.111

5.启动scan和scan_listener

$GRID_HOME/bin/srvctl start scan $GRID_HOME/bin/srvctl start scan_listener

3 修改 private ip

3.1 确保crs集群是打开的

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

./olsnodes -s

P570a Active

P570b Active

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

修改前设置

./oifcfg getif

en0 10.76.31.0 global public

en2 172.168.128.0 global cluster_interconnect

修改private ip,新网络端口号为en8,如果没有修改端口号,则设置的值

还是为en2

./oifcfg setif -global en8/192.76.31.0:cluster_interconnect

./oifcfg delif -global en2

修改后设置

./oifcfg getif

en0 10.76.31.0 global public

en8 192.76.31.0 global cluster_interconnect

3.3 两边节点停止database和crs

./srvctl stop database -d gdcdc -o immedate

./crsctl stop crs

检查是否关闭

ps -ef|grep grid

ps -ef|grep oracle

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

172.168.128.10 p570a-priv

172.168.128.11 p570b-priv

修改为

192.76.31.113 p570a-priv

192.76.31.115 p570b-priv

3.5 修改p570a节点 private ip

用smitty命令修改物理私网ip

smitty tcpip

选择en8

修改ip为 192.76.31.113 掩码为 255.255.255.0

3.6 修改P570b节点 private ip

用smitty命令修改物理私网ip

smitty tcpip

选择en8

修改ip为 192.76.31.115 掩码为 255.255.255.0

3.7 两边节点启动crs

crsctl start crs

检查资源组状态

crsctl status resource –t

如果都online,则没问题。

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

[grid@p570b:/grid/app]$lsnrctl

LSNRCTL for IBM/AIX RISC System/6000: Version 11.2.0.1.0 – Production on 18-MAR-2010 14:19:15

Copyright (c) 1991, 2009, Oracle. All rights reserved.

LSNRCTL> set current listener_scan1

Current Listener is listener_scan1

LSNRCTL> services

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))

Services Summary…

Service “gdcdc” has 2 instance(s).

Instance “gdcdc1″, status READY, has 1 handler(s) for this service…

Handler(s):

“DEDICATED” established:1 refused:0 state:blocked

REMOTE SERVER

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.128.12)(PORT=1521)))

Instance “gdcdc2″, status READY, has 1 handler(s) for this service…

Handler(s):

“DEDICATED” established:0 refused:0 state:ready

REMOTE SERVER

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)( HOST=192.168.128.13)(PORT=1521)))

修改local_listener参数后

[grid@p570a:/grid/app]$lsnrctl services listener_scan1

LSNRCTL for IBM/AIX RISC System/6000: Version 11.2.0.1.0 – Production on 19-MAR-2010 09:47:50

Copyright (c) 1991, 2009, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))

Services Summary…

Service “gdcdc” has 2 instance(s).

Instance “gdcdc1″, status READY, has 1 handler(s) for this service…

Handler(s):

“DEDICATED” established:0 refused:0 state:ready

REMOTE SERVER

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.76.31.113)(PORT=1521)))

Instance “gdcdc2″, status READY, has 1 handler(s) for this service…

Handler(s):

“DEDICATED” established:0 refused:0 state:ready

REMOTE SERVER

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.76.31.115)(PORT=1521)))

PS:如果您想和业内技术大牛交流的话,请加qq群(527933790)或者关注微信公众 号(AskHarries),谢谢!

转载请注明原文出处:Harries Blog™ » 11gr2rac 修改ip地址

赞 (0)

分享到:更多 ()

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址