11GR2 RAC modify vip,public 修改VIP步骤
11GR2 RAC modify vip,public
ip,private ip,scan vip
实施步骤
第1页共11页
目录
1 修改目的.............................................................................................................................................. 3
2 修改public ip,vip,scan vip.......................................................................................................... 3
2.1 停止两边节点数据库,监听,并且停止crs .............................................................................. 3
2.2 修改两边节点的/etc/hosts文件 .............................................................................................. 4
2.3 修改两个节点上的public ip,vip,scan vip .......................................................................... 4
2.3.1 修改p570a节点 public ip ................................................................................................ 4
2.3.2 修改P570b节点 public ip................................................................................................ 4
2.3.3 两边节点启动crs,用oifcfg 命令修改public ip............................................................... 5
2.3.4 修改VIP ........................................................................................................................... 5
2.3.5 两边节点修改local_listener参数..................................................................................... 6
2.3.6 修改SCAN VIP................................................................................................................ 7
3 修改 private ip..................................................................................................................................... 7
3.1 确保crs集群是打开的 ................................................................................................................. 7
3.2 用oifcfg getif 检查和oifcfg setif修改当前private 设置............................................................ 8
3.3 两边节点停止database和crs........................................................................................................ 8
3.4 修改两边节点/etc/hosts表........................................................................................................... 8
3.5 修改p570a节点 private ip........................................................................................................... 8
3.6 修改P570b节点 private ip........................................................................................................... 9
3.7 两边节点启动crs ......................................................................................................................... 9
4 实施总结.............................................................................................................................................. 9
第2页共11页
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
第3页共11页
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
第4页共11页
修改 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
第5页共11页
停止 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 设置
p570a@root#./srvctl 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.检查是否修改成功
p570a@root#./srvctl 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
第7页共11页
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
第8页共11页
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.
第9页共11页
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)))
|