oracle 11g rac 修改IP

1.停止集群

1.1 制定集群ip

1.调整前对应ip表
[root@node1 ~]# cat /etc/hosts
192.168.56.55    node1
192.168.56.155   node1-vip
10.10.10.1      node1-priv

192.168.56.66    node2
192.168.56.166   node2-vip
10.10.10.2         node2-priv

192.168.56.56    rac-scan


2.调整后对应ip表
192.168.56.77    node1
192.168.56.177   node1-vip
10.10.1.3       node1-priv

192.168.56.88    node2
192.168.56.188   node2-vip
10.10.1.4       node2-priv

192.168.56.78    rac-scan

1.2修改两个节点上的public ip,vip,scan vip

注意这里私网ip地址暂时先不做修改,修改private ip时再修改

1.停止两边节点数据库,监听,并且停止crs
grid用户:
[grid@node1 ~]$ ps -ef | grep smon*
root        63     2  0 01:07 ?        00:00:00 [kpsmoused]
root      2613     1  1 01:08 ?        00:00:07 /u01/11.2.0/grid/bin/osysmond.bin
grid      3317     1  0 01:09 ?        00:00:00 asm_smon_+ASM1
oracle    4188     1  0 01:10 ?        00:00:00 ora_smon_prod1
grid      5384  5348  0 01:20 pts/1    00:00:00 grep smon*
1.1 停止数据库,生产环境需依次执行
[grid@node1 ~]$ srvctl stop database -d  prod -o immediate

1.2停止监听
[grid@node1 ~]$ lsnrctl stop

1.3 停止crs,root用户下执行
[root@node1 ~]# /u01/11.2.0/grid/bin/crsctl stop crs

1.4 用ps –ef|grep grid看进程是否完全关闭
[root@node1 ~]# ps -ef | grep grid
root      5347  2157  0 01:19 pts/1    00:00:00 su - grid
grid      5348  5347  0 01:19 pts/1    00:00:00 -bash
root      6501  6234  0 01:27 pts/0    00:00:00 grep grid


1,6 修改前先做个备份
[root@node1 ~]# cp /etc/hosts /etc/hosts.bak
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.56.77    node1
192.168.56.177   node1-vip
10.10.10.1         node2-priv

192.168.56.88    node2
192.168.56.188   node2-vip
10.10.10.2         node2-priv

192.168.56.78    rac-scan

2.修改ip信息

2.1修改网卡信息

[root@node1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 
DEVICE=eth1
IPADDR=192.168.56.77
NETMASK=255.255.255.0

[root@node1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 
DEVICE=eth1
IPADDR=192.168.56.88
NETMASK=255.255.255.0

3.启动crs,修改其余配置

3.1 修改public ip

1.两边节点启动crs,用oifcfg 命令修改public ip 一边节点做即可
[root@node1 ~]# /u01/11.2.0/grid/bin/crsctl start crs
[root@node2 ~]# /u01/11.2.0/grid/bin/crsctl start crs


2.用oifcfg getif查看当前设置
[root@node1 ~]# /u01/11.2.0/grid/bin/oifcfg getif
eth0  10.10.10.0  global  cluster_interconnect
eth1  192.168.56.0  global  public

3.修改
[root@node1 ~]# /u01/11.2.0/grid/bin/oifcfg setif -global eth1/192.168.56.0:public
ps 若主机网段修改,则改eth1/192.168.56.0:public 信息为实际网段信息

4.两边节点确认
[root@node1 ~]# /u01/11.2.0/grid/bin/oifcfg getif
eth0  10.10.10.0  global  cluster_interconnect
eth1  192.168.56.0  global  public

[root@node2 ~]#  /u01/11.2.0/grid/bin/oifcfg getif
eth0  10.10.10.0  global  cluster_interconnect
eth1  192.168.56.0  global  public

3.2修改vip

1.关闭database
srvctl stop database -d  prod -o immediate

2.root用户下运行以下命令
用srvctl config vip 检查vip设置
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl config vip -n node1
VIP exists: /node1-vip/192.168.56.177/192.168.56.0/255.255.255.0/eth1, hosting node node1

[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl config vip -n node2
VIP exists: /node2-vip/192.168.56.188/192.168.56.0/255.255.255.0/eth1, hosting node node2

3.停止vip 服务和修改vip
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl stop listener -n node2
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl stop listener -n node1

[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl stop vip -n node1
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl stop vip -n node2

[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl modify nodeapps -n node1 -A 192.168.56.77/255.255.255.0/eth1
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl modify nodeapps -n node2 -A 192.168.56.88/255.255.255.0/eth1

4.确认是否修改成功
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl config vip -n node1
VIP exists: /192.168.56.177/192.168.56.177/192.168.56.0/255.255.255.0/eth1, hosting node node1

[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl config vip -n node2
VIP exists: /192.168.56.188/192.168.56.188/192.168.56.0/255.255.255.0/eth1, hosting node node2

5.启动vip服务,监听,数据库
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl start vip -n node1
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl start vip -n node2
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl start listener -n node1
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl start listener -n node2
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl start database -d prod

6.两边节点修改local_listener参数
SQL> show parameter listener;

alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.177)(PORT=1521))))' scope=both sid='prod1';
alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.188)(PORT=1521))))' scope=both sid='prod2';

3.3 修改SCAN VIP

1.srvctl config scan 查看当前vip设置
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl config scan
SCAN name: rac-scan, Network: 1/192.168.56.0/255.255.255.0/eth1
SCAN VIP name: scan1, IP: /rac-scan/192.168.56.56

2.用root用户停止scan_listener 和sacn vip
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl stop scan_listener
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl stop scan 
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is not running

3.用root用户修改scan vip
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl  modify scan -n 192.168.56.78

4.检查是否修改成功
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl config scan
SCAN name: 192.168.56.78, Network: 1/192.168.56.0/255.255.255.0/eth1
SCAN VIP name: scan1, IP: /192.168.56.78/192.168.56.78

5.启动scan和scan_listener
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl start scan
[root@node1 ~]# /u01/11.2.0/grid/bin/srvctl start scan_listener

3.4修改 private ip

1.确保crs集群是打开的
[root@node1 ~]# /u01/11.2.0/grid/bin/olsnodes -s
node1	Active
node2	Active

2.用oifcfg getif 检查和oifcfg setif修改当前private 设置修改前设置
[root@node1 ~]# /u01/11.2.0/grid/bin/oifcfg getif
eth0  10.10.10.0  global  cluster_interconnect
eth1  192.168.56.0  global  public

3.修改private ip,如果没有修改端口号,则设置的值还是为eth0,并删除原私有网卡
[root@node1 ~]# /u01/11.2.0/grid/bin/oifcfg setif -global eth0/10.10.1.0:cluster_interconnect
[root@node1 ~]# /u01/11.2.0/grid/bin/oifcfg delif -global eth0/10.10.10.0:cluster_interconnect


4.查看修改后设置
[root@node1 ~]# /u01/11.2.0/grid/bin/oifcfg getif
eth1  192.168.56.0  global  public
eth0  10.10.1.0  global  cluster_interconnect

5.两边节点停止database和crs
[root@node1 ~]# /u01/11.2.0/grid/bin/crsctl stop crs -f
[root@node2 ~]# /u01/11.2.0/grid/bin/crsctl stop crs -f

6.修改两边节点/etc/hosts表
[root@node1 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.56.77    node1
192.168.56.177   node1-vip
10.10.1.1        node2-priv

192.168.56.88    node2
192.168.56.188   node2-vip
10.10.1.2         node2-priv

192.168.56.78    rac-scan

7.修改物理私网ip
[root@node2 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0 
IPADDR=10.10.1.2
[root@node1 ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0 
IPADDR=10.10.1.1
[root@node2 ~]# service network restart

8.两边节点启动crs
[root@node1 ~]# /u01/11.2.0/grid/bin/crsctl start crs
[root@node2 ~]# /u01/11.2.0/grid/bin/crsctl start crs

[root@node1 ~]# /u01/11.2.0/grid/bin/crsctl status res -t

你可能感兴趣的:(oracle,tcp/ip,数据库)