oracle 10g rac modify public ip,private ip,vip修改实验步骤
oracle 10g rac modify public ip,private ip,vip实验步骤
1 实验目的
根据业务的需求,有时需要调整IP,以下为做实验调整前后对应的IP表
调整前对应ip表
主机名 类型 IP 地址 网卡端口
p595test1 public ip 100.192.168.88 en0
p595test1-vip vip 100.192.168.89 en0
p595test1-priv private ip 192.168.4.100 en3
p595test2 public ip 100.192.168.90 en0
p595test2-vip vip 100.192.168.91 en0
p595test2-priv private ip 192.168.4.101 en3
调整后对应ip表
主机名 类型 IP 地址 网卡端口
p595test1 public ip 200.200.200.1 en0
p595test1-vi vip 200.200.200.2 en0
p595test1-priv private ip 192.168.5.100 en3
p595test2public ip 200.200.200.3 en0
p595test2-vip vip 200.200.200.4 en0
p595test2-priv private ip 192.168.5.101 en3
2 实验一修改public ip与private ip
2.1两边节点 停止数据库,监听,asm,gsd,vip,ons服务
oracle用户
srvctl stop database -d test959 -o immediate
srvctl stop asm -n p595test1
srvctl stop asm -n p595test2
srvctl stop nodeapps -n p595test1
srvctl stop nodeapps -n p595test2
root用户
./crsctl stop crs
2.2 修改两边节点的/etc/hosts文件
修改前先做个备份
cp /etc/hosts /etc/hosts.bak
修改后如下所示:
200.200.200.1 p595test1
200.200.200.2 p595test1-vip
192.168.5.100 p595test1-priv
200.200.200.3 p595test2
200.200.200.4 p595test2-vip
192.168.5.101 p595test2-priv
2.3 修改p595a节点上的public ip与private ip
2.3.1 用smitty命令修改物理ip
smitty tcpip
修改public ip
选择en0
修改ip为 200.200.200.1,网关为200.200.200.254
修改private ip
选择en3
修改ip为 192.168.5.100
注意检查修改hosts文件,因为改ip后,hosts文件会增加记录。
2.3.2 用oifcfg命令修改ip更新ocr盘
root用户启动crs
./crsctl start crs
oracle用户
先查看
oifcfg getif
en0 100.192.168.0 global public
en3 192.168.4.0 global cluster_interconnect
修改
oifcfg delif -global en0
oifcfg setif -global en0/200.200.200.0:public
oifcfg delif -global en3
oifcfg setif -global en3/192.168.5.0:cluster_interconnect
确认
oifcfg getif
en0 200.200.200.0 global public
en3 192.168.5.0 global cluster_interconnect
2.4 修改p595test2节点上的public ip与private ip
2.4.1 用smitty命令修改物理ip
smitty tcpip
修改public ip
选择en0
修改ip为 200.200.200.3,网关为200.200.200.254
修改private ip
选择en3
修改ip为 192.168.5.101
注意检查修改hosts文件,因为改ip后,hosts文件会增加记录。
2.4.2 启动crs
root用户启动crs
cd /crs/app/oracle/product/crs_1/bin
./crsctl start crs
2.4.3 用oifcfg命令检查ocr盘中ip信息
oracle用户
oifcfg getif
en0 200.200.200.0 global public
en3 192.168.5.0 global cluster_interconnect
注意这边不需要修改,只是确认。
2.5 修改listener.ora与tnsnames.ora文件
cd $ORACLE_HOME/network/admin
涉及到有public ip的地方都要修改
2.6 验证两边节点服务状态是否正常
crs_stat –t
[oracle@p595test1:/oracle/app/oracle]$crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.test959.db application ONLINE ONLINE p595test1
ora....k1.inst application ONLINE ONLINE p595test1
ora....k2.inst application ONLINE ONLINE p595test2
ora....SM1.asm application ONLINE ONLINE p595test1
ora....A2.lsnr application ONLINE ONLINE p595test1
ora.p595test1.gsd application ONLINE ONLINE p595test1
ora.p595test1.ons application ONLINE ONLINE p595test1
ora.p595test1.vip application ONLINE ONLINE p595test1
ora....SM2.asm application ONLINE ONLINE p595test2
ora....B2.lsnr application ONLINE ONLINE p595test2
ora.p595test2.gsd application ONLINE ONLINE p595test2
ora.p595test2.ons application ONLINE ONLINE p595test2
ora.p595test2.vip application ONLINE ONLINE p595test2
3 实验二修改vip
3.1 停止数据库,监听,asm,gsd,vip,ons服务
oracle用户下运行以下命令
srvctl stop database -d test959 -o immediate
srvctl stop asm -n p595test1
srvctl stop asm -n p595test2
srvctl stop nodeapps -n p595test1
srvctl stop nodeapps -n p595test2
3.2 用srvctl config nodeapps 检查vip设置
oracle用户
srvctl config nodeapps -n p595test1 -a
VIP exists.: /p595test1-vip/100.192.168.89/255.255.255.0/en0
srvctl config nodeapps -n p595test2 -a
VIP exists.: /p595test1-vip/100.192.168.91/255.255.255.0/en0
3.3 用srvctl modify nodeapps 修改vip地址
oracle用户
srvctl modify nodeapps -n p595test1 -A 200.200.200.2/255.255.255.0/en0
srvctl modify nodeapps -n p595test2 -A 200.200.200.4/255.255.255.0/en0
确认
srvctl config nodeapps -n p595test1 -a
VIP exists.: /p595test1-vip/200.200.200.2/255.255.255.0/en0
srvctl config nodeapps -n p595test2 -a
VIP exists.: /p595test1-vip/200.200.200.4/255.255.255.0/en0
3.4 修改listener.ora与tnsnames.ora文件
cd $ORACLE_HOME/network/admin
涉及到有vip的地方都要修改
3.5 启动数据库,监听,asm,gsd,vip,ons服务
oracle用户
srvctl start nodeapps -n p595test1
srvctl start nodeapps -n p595test2
srvctl start asm -n p595test1
srvctl start asm -n p595test2
srvctl start database -d test959
3.6 验证两边节点服务状态是否正常
crs_stat –t
[oracle@p595test1:/oracle/app/oracle]$crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.test959.db application ONLINE ONLINE p595test1
ora....k1.inst application ONLINE ONLINE p595test1
ora....k2.inst application ONLINE ONLINE p595test2
ora....SM1.asm application ONLINE ONLINE p595test1
ora....A2.lsnr application ONLINE ONLINE p595test1
ora.p595test1.gsd application ONLINE ONLINE p595test1
ora.p595test1.ons application ONLINE ONLINE p595test1
ora.p595test1.vip application ONLINE ONLINE p595test1
ora....SM2.asm application ONLINE ONLINE p595test2
ora....B2.lsnr application ONLINE ONLINE p595test2
ora.p595test2.gsd application ONLINE ONLINE p595test2
ora.p595test2.ons application ONLINE ONLINE p595test2
ora.p595test2.vip application ONLINE ONLINE p595test2
4 实验总结
1. 在修改public ip时注意修改对应的网关,如果不修改,有可能导致vip服务起不来。