ITPub博客

首页 > 数据库 > Oracle > oracle 11g rac 修改IP(public ip,private ip,scan ip,vip)

oracle 11g rac 修改IP(public ip,private ip,scan ip,vip)

Oracle 作者:流沙三千 时间:2013-02-26 23:39:01 0 删除 编辑

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
第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,这里10.76.31.0是网络号(subnet),可以通过IP地址和网关以及子网掩码算出来。
两边节点确认
./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

在11g里,确认是否修改成功,输入的格式是:hostname/vip/subnet/netmash/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
第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
第10页共11页
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.76.31.115)(PORT=1521)))

 

 

第二部分,单独修改scan ip

Clusterware :11.2.0.2
database    :11.2.0.1
旧scan ip
10.250.7.210
新scan ip
10.250.7.141
10.250.7.142
10.250.7.143
 
1 查看scan ip的状态信息:
 
grid@rac1:/home/grid>srvctl config scan
SCAN 名称: scan, 网络: 1/10.250.7.0/255.255.255.0/eth0
SCAN VIP 名称: scan1, IP: /scan/10.250.7.210
grid@rac1:/home/grid>
2 停止scan_listener ,scan 应用
grid@rac1:/home/grid>srvctl stop scan_listener
grid@rac1:/home/grid>srvctl stop scan
 
3 确认 scan_listener,scan 的状态
grid@rac1:/home/grid>srvctl status scan_listener
SCAN 监听程序 LISTENER_SCAN1 已启用
SCAN 监听程序 LISTENER_SCAN1 未运行
grid@rac1:/home/grid>srvctl status scan
SCAN VIP scan1 已启用  www.2cto.com  
SCAN VIP scan1 未运行
grid@rac1:/home/grid>crs_stat -t | grep  scan 
ora.scan1.vip  ora....ip.type OFFLINE   OFFLINE              
grid@rac1:/home/grid>
grid@rac1:/home/grid>
grid@rac1:/home/grid>crs_stat -t | grep  lsnr
ora....ER.lsnr ora....er.type ONLINE    ONLINE    rac1       
ora....N1.lsnr ora....er.type OFFLINE   OFFLINE              
ora....C1.lsnr application    ONLINE    ONLINE    rac1       
ora....C2.lsnr application    ONLINE    ONLINE    rac2
 
4 在所有节点中 /etc/hosts 文件中修改 scan 对应的ip:
10.250.7.141        scan
10.250.7.142        scan
10.250.7.143        scan
grid@rac1:/home/grid>srvctl modify scan -h
修改 SCAN 名称。
用法: srvctl modify scan -n
    -n           域名限定的 SCAN 名
    -h                       输出用法
grid 用户无权更改scan ip,必须使用root权限
grid@rac1:/home/grid>srvctl modify scan -n scan 
PRCS-1034 : 无法修改单客户机访问名 scan
PRCR-1071 : 无法注册或更新 资源类型 ora.scan_vip.type
CRS-0245:  User does not have enough privilege to perform. the operation
[root@rac1 ~]# /opt/11202/11.2.0/grid/bin/srvctl modify scan -n scan
 
5 变更后,进行确认:  www.2cto.com  
[root@rac1 ~]# /opt/11202/11.2.0/grid/bin/srvctl config scan
SCAN 名称: scan, 网络: 1/10.250.7.0/255.255.255.0/eth0
SCAN VIP 名称: scan1, IP: /scan/10.250.7.141  <====只有一个scan ip
对于/etc/hosts文件解析scan ip,因为不能做轮训的负载均衡,所以这时候scan ip就只能有一个了。
6 重新启动scan,scan_listener
grid@rac1:/home/grid>srvctl start scan
grid@rac1:/home/grid>srvctl start scan_listener
 
7 确认scan 和scan_listener.ora的状态:
grid@rac1:/home/grid>crs_stat -t | grep  scan
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    rac2       
grid@rac1:/home/grid>crs_stat -t | grep  lsnr
ora....ER.lsnr ora....er.type ONLINE    ONLINE    rac1       
ora....N1.lsnr ora....er.type ONLINE    ONLINE    rac2       
ora....C1.lsnr application    ONLINE    ONLINE    rac1       
ora....C2.lsnr application    ONLINE    ONLINE    rac2
进行ping测试  www.2cto.com  
grid@rac1:/home/grid>ping 10.250.7.141
PING 10.250.7.141 (10.250.7.141) 56(84) bytes of data.
64 bytes from 10.250.7.141: icmp_seq=1 ttl=64 time=1.52 ms
64 bytes from 10.250.7.141: icmp_seq=2 ttl=64 time=0.226 ms
--- 10.250.7.141 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.226/0.873/1.520/0.647 ms
grid@rac1:/home/grid>ping 10.250.7.142
PING 10.250.7.142 (10.250.7.142) 56(84) bytes of data.
与修改private ip ,vip 不一样,修改scan ip 无需停止数据库实例,asm 或者重启crs,相对比较简单!


 

<!-- 正文结束 -->

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23030912/viewspace-1116306/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2009-12-15