调整前 主机的ip地址在192.168.1.0网段的,调整后ip地址在192.168.50.0 网段。
1、停止数据库
停止两边节点数据库,监听,并且停止crs
grid用户
srvctl stop database -d gdcdc -o immediate
srvctl stop listener -n rac1
srvctl stop listener -n rac2
root用户
cd /grid/app/11.2.0/grid/bin
./crsctl stop crs
2、要改/etc/hosts 地址
修改前先做个备份 /etc/hosts
root@rac1 ]$ cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
#public
192.168.50.112 rac1
192.168.50.113 rac2
#private
1.1.1.2 rac1-priv
1.1.1.3 rac2-priv
#virtual
192.168.50.114 rac1-vip
192.168.50.115 rac2-vip
#scan
192.168.50.116 rac-scan
192.168.50.117 rac-scan2
192.168.50.118 rac-scan3
3、修改主机的ip地址
4、要改存储的挂载ip地址
5、修改public ip,vip,scan vip
修改public ip
值要在一个节点修改就可以
[root@rac2 bin]# ./oifcfg getif
eth0 192.168.1.0 global public
eth0 1.1.1.0 global cluster_interconnect
修改
./oifcfg delif -global en0
./oifcfg setif -global en0/192.168.50.0:public
两边节点确认
[grid@rac1 bin]$ ./oifcfg getif
eth0 192.168.1.0 global public
eth0 1.1.1.0 global cluster_interconnect
en0 192.168.50.0 global public
[root@rac2 bin]# ./oifcfg getif
eth0 192.168.1.0 global public
eth0 1.1.1.0 global cluster_interconnect
en0 192.168.50.0 global public
修改vip
在数据库关闭的情况下修改
[grid@rac1 bin]$ ./srvctl stop database -d test
[grid@rac1 bin]$ srvctl config vip -n rac1
VIP 已存在。:rac1
VIP 已存在。: /rac1-vip/192.168.50.114/255.255.255.0/eth0
[grid@rac1 bin]$ srvctl config vip -n rac2
VIP 已存在。:rac2
VIP 已存在。: /rac2-vip/192.168.50.115/255.255.255.0/eth0
虽然上面显示的是正确的但是在下面查看scanip的时候显示网段是错误的
[root@rac2 bin]# ./srvctl config scan
SCAN 名称: rac-scan, 网络: 1/192.168.1.0/255.255.255.0/eth0
SCAN VIP 名称: scan1, IP: /192.168.1.116/192.168.1.116
最后又重新修改了vip后,scan ip地址查看是正确的:
[root@rac1 bin]# ./srvctl modify nodeapps -n rac1 -A 192.168.50.114/255.255.255.0/eth0
[root@rac1 bin]# ./srvctl config scan
SCAN 名称: 192.168.50.116, 网络: 1/192.168.50.0/255.255.255.0/eth0
SCAN VIP 名称: scan1, IP: /rac-scan/192.168.50.116
说明vip地址已经正确
如果不正确可以使用下列命令修改
./srvctl stop listener -n rac1
./srvctl stop listener -n rac2
./srvctl stop vip -n rac1
./srvctl stop vip -n rac2
./srvctl modify nodeapps -n rac1 -A 192.168.50.114 /255.255.255.0/en0
./srvctl modify nodeapps -n rac2 -A 192.168.50.115/255.255.255.0/en0
修改完后再次确认ip地址是否修改正确
[grid@rac1 bin]$ srvctl config vip -n rac1
[grid@rac1 bin]$ srvctl config vip -n rac2
启动vip服务,监听,数据库
./srvctl start vip -n rac1
./srvctl start vip -n rac2
./srvctl start listener -n rac1
./srvctl start listener -n rac2
./srvctl start database –d test
修改scan ip
[root@rac2 bin]# ./srvctl config scan
SCAN 名称: rac-scan, 网络: 1/192.168.1.0/255.255.255.0/eth0
SCAN VIP 名称: scan1, IP: /192.168.1.116/192.168.1.116
./srvctl modify scan -n 192.168.50.116
root@rac2 bin]# ./srvctl config scan
SCAN 名称: 192.168.50.116, 网络: 1/192.168.50.0/255.255.255.0/eth0
SCAN VIP 名称: scan1, IP: /rac-scan/192.168.50.116
如果需要修改private
(1)rac01:vi /etc/sysconfig/network-scripts/ifcfg-eth0
修改ip为15.1.1.1掩码255.255.255.0
service network restart//重启网卡
(2)rac02:vi/etc/sysconfig/network-scripts/ifcfg-eth0
修改ip为15.1.1.2掩码 255.255.255.0
service network restart//重启网卡
启动VIP、监听、scan和scan_listener、数据库
./srvctl enable listener
./srvctl enable vip -i "rac1-vip"
./srvctl enable vip -i "rac2-vip"
./srvctl enable scan_listener
./srvctl enable scan
./srvctl enable database -d test
./srvctl start listener
./srvctl start vip -n rac1,rac2
./srvctl start scan_listener
./srvctl start scan
./srvctl start database -d test