1 实验目的
根据业务的需求,有时需要调整IP,以下为做调整前后对应的IP表
调整前对应ip表
主机名 类型 IP 地址 网卡端口
p595a2 public ip 1.4.128.88 en0
p595a2-vip vip 1.4.128.89 en0
p595a2-priv private ip 192.168.4.100 en3
p595b2 public ip 1.4.128.90 en0
p595b2-vip vip 1.4.128.91 en0
p595b2-priv private ip 192.168.4.101 en3
调整后对应ip表
主机名 类型 IP 地址 网卡端口
p595a2 public ip 200.200.200.1 en0
p595a2-vi vip 200.200.200.2 en0
p595a2-priv private ip 192.168.5.100 en3
p595b2 public ip 200.200.200.3 en0
p595b2-vip vip 200.200.200.4 en0
p595b2-priv private ip 192.168.5.101 en3
2 实验一修改public ip与private ip
2.1两边节点 停止,监听,asm,gsd,vip,ons服务
用户
srvctl stop database -d fsyyk -o immediate
srvctl stop asm -n p595a2
srvctl stop asm -n p595b2
srvctl stop nodeapps -n p595a2
srvctl stop nodeapps -n p595b2
root用户
./crsctl stop crs
2.2 修改两边节点的/etc/hosts文件
修改前先做个
cp /etc/hosts /etc/hosts.bak
修改后如下所示:
200.200.200.1 p595a2
200.200.200.2 p595a2-vip
192.168.5.100 p595a2-priv
200.200.200.3 p595b2
200.200.200.4 p595b2-vip
192.168.5.101 p595b2-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 1.4.128.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 修改p595b节点上的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@p595a2:/oracle/app/oracle]$crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.fsyyk.db application ONLINE ONLINE p595a2
ora....k1.inst application ONLINE ONLINE p595a2
ora....k2.inst application ONLINE ONLINE p595b2
ora....SM1.asm application ONLINE ONLINE p595a2
ora....A2.lsnr application ONLINE ONLINE p595a2
ora.p595a2.gsd application ONLINE ONLINE p595a2
ora.p595a2.ons application ONLINE ONLINE p595a2
ora.p595a2.vip application ONLINE ONLINE p595a2
ora....SM2.asm application ONLINE ONLINE p595b2
ora....B2.lsnr application ONLINE ONLINE p595b2
ora.p595b2.gsd application ONLINE ONLINE p595b2
ora.p595b2.ons application ONLINE ONLINE p595b2
ora.p595b2.vip application ONLINE ONLINE p595b2
3 实验二修改vip
3.1 停止数据库,监听,asm,gsd,vip,ons服务
oracle用户下运行以下命令
srvctl stop database -d fsyyk -o immediate
srvctl stop asm -n p595a2
srvctl stop asm -n p595b2
srvctl stop nodeapps -n p595a2
srvctl stop nodeapps -n p595b2
3.2 用srvctl config nodeapps 检查vip设置
oracle用户
srvctl config nodeapps -n p595a2 -a
VIP exists.: /p595a2-vip/1.4.128.89/255.255.255.0/en0
srvctl config nodeapps -n p595b2 -a
VIP exists.: /p595a2-vip/1.4.128.91/255.255.255.0/en0
3.3 用srvctl modify nodeapps 修改vip地址
oracle用户
srvctl modify nodeapps -n p595a2 -A 200.200.200.2/255.255.255.0/en0
srvctl modify nodeapps -n p595b2 -A 200.200.200.4/255.255.255.0/en0
确认
srvctl config nodeapps -n p595a2 -a
VIP exists.: /p595a2-vip/200.200.200.2/255.255.255.0/en0
srvctl config nodeapps -n p595b2 -a
VIP exists.: /p595a2-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 p595a2
srvctl start nodeapps -n p595b2
srvctl start asm -n p595a2
srvctl start asm -n p595b2
srvctl start database -d fsyyk
3.6 验证两边节点服务状态是否正常
crs_stat –t
[oracle@p595a2:/oracle/app/oracle]$crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.fsyyk.db application ONLINE ONLINE p595a2
ora....k1.inst application ONLINE ONLINE p595a2
ora....k2.inst application ONLINE ONLINE p595b2
ora....SM1.asm application ONLINE ONLINE p595a2
ora....A2.lsnr application ONLINE ONLINE p595a2
ora.p595a2.gsd application ONLINE ONLINE p595a2
ora.p595a2.ons application ONLINE ONLINE p595a2
ora.p595a2.vip application ONLINE ONLINE p595a2
ora....SM2.asm application ONLINE ONLINE p595b2
ora....B2.lsnr application ONLINE ONLINE p595b2
ora.p595b2.gsd application ONLINE ONLINE p595b2
ora.p595b2.ons application ONLINE ONLINE p595b2
ora.p595b2.vip application ONLINE ONLINE p595b2
4 实验总结
1. 在修改public ip时注意修改对应的网关,如果不修改,有可能导致vip服务起不来。