更改ip:
How to Modify Public Network Information including VIP in Oracle Clusterware (文档 ID 276434.1)
How to Modify Private Network Information in Oracle Clusterware (文档 ID 283684.1)
如何修改集群的公网信息(包括 VIP) (文档 ID 1674442.1)
如何在 oracle 集群环境下修改私网信息 (文档 ID 2103317.1)
oracle release 11.2.0.4.0
本次实验模式netmask:255.255.255.0
一:修改主机ip,vip,scan(网卡名称不变)
二:修改Private IP(网卡名称不变)
三:修改公网网卡名称(ip地址不变)
四:修改Private网卡名称(ip地址不变)
五:修改公网网卡名称,ip
六:修改Private网卡名称,ip
附录:子网掩码地址计算
ocr,olr,gpnp profile:
备份:2台主机:
gpnp profile备份(所有节点)
私有网络配置存在olr中,还存在gpnp profile中,所以首先需要备份profile.xml(所有节点都需要备份):
[grid@host01 peer]$ pwd
/u01/11.2.0/grid/gpnp/host01/profiles/peer
[grid@host01 peer]$ ls
pending.xml profile.old profile_orig.xml profile.xml
[grid@host01 peer]$ cp profile.xml profile.xml.bak
[root@host02 ~]# cd /u01/11.2.0/grid/gpnp/host02/profiles/peer/
[root@host02 peer]# ls
profile_orig.xml profile.xml
[root@host02 peer]# cp profile.xml profile.xml.bak
Olr备份:(2个节点都需要备份)
[root@prod01 ~]# /u01/app/11.2.0/grid/bin/ocrcheck -local
Status of Oracle Local Registry is as follows :
Version : 3
Total space (kbytes) : 262120
Used space (kbytes) : 2744
Available space (kbytes) : 259376
ID : 2074739229
Device/File Name : /u01/app/11.2.0/grid/cdata/prod01.olr
Device/File integrity check succeeded
Local registry integrity check succeeded
Logical corruption check succeeded
[root@prod01 ~]# /u01/app/11.2.0/grid/bin/ocrconfig -local -manualbackup
prod01 2018/11/22 08:28:26 /u01/app/11.2.0/grid/cdata/prod01/backup_20181122_082826.olr
prod01 2018/11/21 16:49:49 /u01/app/11.2.0/grid/cdata/prod01/backup_20181121_164949.ol
prod01 2018/10/26 10:24:01 /u01/app/11.2.0/grid/cdata/prod01/backup_20181026_102401.olr
[root@prod01 ~]# /u01/app/11.2.0/grid/bin/ocrconfig -local -showbackup
prod01 2018/11/22 08:28:26 /u01/app/11.2.0/grid/cdata/prod01/backup_20181122_082826.olr
prod01 2018/11/21 16:49:49 /u01/app/11.2.0/grid/cdata/prod01/backup_20181121_164949.olr
prod01 2018/10/26 10:24:01 /u01/app/11.2.0/grid/cdata/prod01/backup_20181026_102401.olr
Ocr备份:
[root@host01 ~]# /u01/11.2.0/grid/bin/ocrconfig -manualbackup
host02 2018/03/29 08:48:19 /u01/11.2.0/grid/cdata/host-cluster/backup_20180329_084819.ocr
[root@host01 ~]# /u01/11.2.0/grid/bin/ocrconfig -showbackup
host02 2018/03/29 06:08:55 /u01/11.2.0/grid/cdata/host-cluster/backup00.ocr
host02 2018/03/29 02:08:55 /u01/11.2.0/grid/cdata/host-cluster/backup01.ocr
host02 2018/03/28 22:08:54 /u01/11.2.0/grid/cdata/host-cluster/backup02.ocr
host02 2018/03/28 22:08:54 /u01/11.2.0/grid/cdata/host-cluster/day.ocr
host02 2018/03/28 22:08:54 /u01/11.2.0/grid/cdata/host-cluster/week.ocr
host02 2018/03/29 08:48:19 /u01/11.2.0/grid/cdata/host-cluster/backup_20180329_084819.ocr
hosts配置文件备份:
cp /etc/hosts /tmp/hosts.bak0329
情景一
修改主机ip,vip,scan(网卡名称不变)
修改之前:
192.168.0.35 host01
192.168.0.36 host01-vip
192.168.0.38 host02
192.168.0.39 host02-vip
192.168.0.40 scan
修改之后:
172.16.0.135 host01
172.16.0.136 host01-vip
172.16.0.138 host02
172.16.0.139 host02-vip
172.16.0.140 scan
1.正常关库、监听和CRS
/u01/11.2.0/grid/bin/crsctl stop crs
2.修改/etc/hosts配置文件
172.16.0.135 host01
172.16.0.136 host01-vip
172.16.0.138 host02
172.16.0.139 host02-vip
172.16.0.140 scan
3.OS层修改公有网卡地址
4.启动crs
/u01/11.2.0/grid/bin/crsctl start crs
5.修改Public IP
[grid@host01 ~]$ oifcfg iflist
eth3 172.16.0.0
eth4 10.168.0.0
eth4 169.254.0.0
[grid@host01 ~]$ oifcfg getif
eth3 192.168.0.0 global public
eth4 10.168.0.0 global cluster_interconnect
[grid@host01 ~]$ oifcfg delif -global eth3
[grid@host01 ~]$ oifcfg setif -global eth3/172.16.0.0:public
[grid@host01 ~]$ oifcfg getif
eth4 10.168.0.0 global cluster_interconnect
eth3 172.16.0.0 global public
6.修改VIP--停止数据库和监听
srvctl stop vip -n host01
srvctl stop vip -n host02
root用户修改:
srvctl modify nodeapps -n host01 -A 172.16.0.136/255.255.255.0/eth3
srvctl modify nodeapps -n host02 -A 172.16.0.139/255.255.255.0/eth3
[root@host01 ~]# /u01/11.2.0/grid/bin/srvctl config vip -n host01
VIP exists: /172.16.0.136/172.16.0.136/172.16.0.0/255.255.255.0/eth3, hosting node host01
[root@host01 ~]# /u01/11.2.0/grid/bin/srvctl config vip -n host02
VIP exists: /host02-vip/172.16.0.139/172.16.0.0/255.255.255.0/eth3, hosting node host02
/u01/11.2.0/grid/bin/srvctl start vip -n host01
/u01/11.2.0/grid/bin/srvctl start vip -n host02
确认local_listener信息: //DB,ASM实例都需要确认。
检查local_listener信息,如果不正确需要修改,我这里查询是正确的。
--两个节点分别确认:
show parameter local_listener
--修改:
alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.0.136)(PORT=1521))' sid='orcl1';
alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.0.139)(PORT=1521))' sid='orcl2';
7.修改SCAN VIP
srvctl stop scan_listener
srvctl stop scan
srvctl status scan_listener
srvctl status scan
root
/u01/11.2.0/grid/bin/srvctl modify scan -n scan
/u01/11.2.0/grid/bin/srvctl config scan
SCAN name: scan, Network: 1/172.16.0.0/255.255.255.0/eth3
SCAN VIP name: scan1, IP: /scan/172.16.0.140
/u01/11.2.0/grid/bin/srvctl start scan
/u01/11.2.0/grid/bin/srvctl start scan_listener
情景二
修改Private IP
修改前:
10.168.0.123/24--eth4
10.168.0.124/24--eth4
修改后地址
100.16.0.23/24--eth4
100.16.0.24/24--eth4
1,添加新的网络信息
[grid@host01 ~]$ oifcfg getif
eth4 10.168.0.0 global cluster_interconnect
eth3 192.168.0.0 global public
[grid@host01 ~]$
新的子网具有相同网卡的名称但不同的子网:
[grid@host01 ~]$ oifcfg setif -global eth4/100.16.0.0:cluster_interconnect
[grid@host01 ~]$ oifcfg getif
eth4 10.168.0.0 global cluster_interconnect
eth4 100.16.0.0 global cluster_interconnect
eth3 172.16.0.0 global public
2,关闭crs
root执行
/u01/11.2.0/grid/bin/crsctl stop crs
3,修改主机ip地址
4,启动crs
/u01/11.2.0/grid/bin/crsctl start crs
5,删除旧的网络信息
[grid@host01 ~]$ oifcfg delif -global eth4/10.168.0.0
[grid@host01 ~]$ oifcfg getif
eth4 100.16.0.0 global cluster_interconnect
eth5 172.16.0.0 global public
情景三
公网网卡名称 eth3===>eth5
1,修改网卡信息
[grid@host01 ~]$ oifcfg getif
eth4 10.168.0.0 global cluster_interconnect
eth4 100.16.0.0 global cluster_interconnect
eth3 172.16.0.0 global public
[grid@host01 ~]$ oifcfg iflist
eth5 172.16.0.0
eth4 100.16.0.0
eth4 169.254.0.0
[grid@host01 ~]$ oifcfg setif -global eth5/172.16.0.0:public
[grid@host01 ~]$ oifcfg getif
eth4 10.168.0.0 global cluster_interconnect
eth4 100.16.0.0 global cluster_interconnect
eth3 172.16.0.0 global public
eth5 172.16.0.0 global public
[grid@host01 ~]$ oifcfg delif -global eth3/172.16.0.0:public
[grid@host01 ~]$ oifcfg getif
eth4 10.168.0.0 global cluster_interconnect
eth4 100.16.0.0 global cluster_interconnect
eth5 172.16.0.0 global public
2,停止crs
3,修改操作系统网卡名称
4,启动crs
5,修改vip,scan
root执行
srvctl stop vip -n host01
srvctl stop vip -n host02
srvctl modify nodeapps -n host01 -A 172.16.0.136/255.255.255.0/eth5
srvctl modify nodeapps -n host02 -A 172.16.0.139/255.255.255.0/eth5
[root@host01 host01]# /u01/11.2.0/grid/bin/srvctl config vip -n host01
VIP exists: /172.16.0.136/172.16.0.136/172.16.0.0/255.255.255.0/eth5, hosting node host01
[root@host01 host01]# /u01/11.2.0/grid/bin/srvctl config vip -n host02
VIP exists: /host02-vip/172.16.0.139/172.16.0.0/255.255.255.0/eth5, hosting node host02
/u01/11.2.0/grid/bin/srvctl start vip -n host01
/u01/11.2.0/grid/bin/srvctl start vip -n host02
情景四
修改Private网卡名称 eth4===>eth3
1,添加新的网络信息
[grid@host01 ~]$
[grid@host01 ~]$ oifcfg setif -global eth3/100.16.0.0:cluster_interconnect
[grid@host01 ~]$ oifcfg getif
eth4 100.16.0.0 global cluster_interconnect
eth5 172.16.0.0 global public
eth3 100.16.0.0 global cluster_interconnect
2,停止crs
3,修改主机网卡信息
4,启动crs
5,删除多余网络信息
[grid@host01 ~]$ oifcfg getif
eth4 100.16.0.0 global cluster_interconnect
eth5 172.16.0.0 global public
eth3 100.16.0.0 global cluster_interconnect
[grid@host01 ~]$ oifcfg delif -global eth4/100.16.0.0
[grid@host01 ~]$ oifcfg getif
eth5 172.16.0.0 global public
eth3 100.16.0.0 global cluster_interconnect
===========
修改之前:
[root@host02 network-scripts]# ip a s
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth5: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:50:56:8e:06:87 brd ff:ff:ff:ff:ff:ff
inet 172.16.0.138/24 brd 172.16.0.255 scope global eth5
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:687/64 scope link
valid_lft forever preferred_lft forever
3: eth3: mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:50:56:8e:8c:39 brd ff:ff:ff:ff:ff:ff
4: eth4: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:50:56:8e:2d:83 brd ff:ff:ff:ff:ff:ff
inet 100.16.0.24/24 brd 100.16.0.255 scope global eth4
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:2d83/64 scope link
valid_lft forever preferred_lft forever
=============
修改之后
[root@host02 network-scripts]# ip a s
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth5: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:50:56:8e:06:87 brd ff:ff:ff:ff:ff:ff
inet 172.16.0.138/24 brd 172.16.0.255 scope global eth5
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:687/64 scope link
valid_lft forever preferred_lft forever
3: eth3: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:50:56:8e:8c:39 brd ff:ff:ff:ff:ff:ff
inet 100.16.0.24/24 brd 100.16.0.255 scope global eth3
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:8c39/64 scope link
valid_lft forever preferred_lft forever
4: eth4: mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:50:56:8e:2d:83 brd ff:ff:ff:ff:ff:ff
=========
五:修改公网网卡名称,ip
修改之前:<<<==========eth5
172.16.0.135 host01
172.16.0.136 host01-vip
172.16.0.138 host02
172.16.0.139 host02-vip
172.16.0.140 scan
[root@host01 network-scripts]# ip a s
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth5: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:50:56:8e:71:9f brd ff:ff:ff:ff:ff:ff
inet 172.16.0.135/24 brd 172.16.0.255 scope global eth5
valid_lft forever preferred_lft forever
inet 172.16.0.136/24 brd 172.16.0.255 scope global secondary eth5:3
valid_lft forever preferred_lft forever
inet 172.16.0.140/24 brd 172.16.0.255 scope global secondary eth5:2
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:719f/64 scope link
valid_lft forever preferred_lft forever
3: eth3: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:50:56:8e:48:2b brd ff:ff:ff:ff:ff:ff
inet 100.16.0.23/24 brd 100.16.0.255 scope global eth3
valid_lft forever preferred_lft forever
inet 169.254.199.73/16 brd 169.254.255.255 scope global eth3:1
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:482b/64 scope link
valid_lft forever preferred_lft forever
4: eth4: mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:50:56:8e:a3:f9 brd ff:ff:ff:ff:ff:ff
修改之后:<<<==========eth4
192.168.0.35 host01
192.168.0.36 host01-vip
192.168.0.38 host02
192.168.0.39 host02-vip
192.168.0.40 scan
1,停止crs
2,修改hosts
3,修改主机ip地址到新网卡
4,启动crs
5,修改网卡信息
[grid@host01 ~]$ oifcfg iflist
eth3 100.16.0.0
eth3 169.254.0.0
eth4 192.168.0.0
[grid@host01 ~]$ oifcfg getif
eth5 172.16.0.0 global public
eth3 100.16.0.0 global cluster_interconnec
[grid@host01 ~]$ oifcfg delif -global eth5
[grid@host01 ~]$ oifcfg setif -global eth4/192.168.0.0:public
[grid@host01 ~]$ oifcfg setif -global eth4/192.168.0.0:public
[grid@host01 ~]$ oifcfg getif
eth3 100.16.0.0 global cluster_interconnect
eth4 192.168.0.0 global public
6,修改vip,scan地址
root用户修改:
srvctl stop vip -n host01
srvctl stop vip -n host02
root用户修改:
srvctl modify nodeapps -n host01 -A 192.168.0.36/255.255.255.0/eth4
srvctl modify nodeapps -n host02 -A 192.168.0.39/255.255.255.0/eth4
/u01/11.2.0/grid/bin/srvctl start vip -n host01
/u01/11.2.0/grid/bin/srvctl start vip -n host02
确认local_listener信息: //DB,ASM实例都需要确认。
检查local_listener信息,如果不正确需要修改,我这里查询是正确的。
--两个节点分别确认:
show parameter local_listener
--修改:
alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST= host01-vip)(PORT=1521))' sid='orcl1';
alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST= host02-vip)(PORT=1521))' sid='orcl2';
修改scan
srvctl stop scan_listener
srvctl stop scan
srvctl status scan_listener
srvctl status scan
root
/u01/11.2.0/grid/bin/srvctl modify scan -n scan
/u01/11.2.0/grid/bin/srvctl config scan
SCAN name: scan, Network: 1/192.168.0.0/255.255.255.0/eth4
SCAN VIP name: scan1, IP: /scan/192.168.0.40
/u01/11.2.0/grid/bin/srvctl start scan
/u01/11.2.0/grid/bin/srvctl start scan_listener
修改之后ip地址信息:
[root@host01 network-scripts]# ip a s
1: lo: mtu 65536 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth5: mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:50:56:8e:71:9f brd ff:ff:ff:ff:ff:ff
3: eth3: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:50:56:8e:48:2b brd ff:ff:ff:ff:ff:ff
inet 100.16.0.23/24 brd 100.16.0.255 scope global eth3
valid_lft forever preferred_lft forever
inet 169.254.199.73/16 brd 169.254.255.255 scope global eth3:1
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:482b/64 scope link
valid_lft forever preferred_lft forever
4: eth4: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:50:56:8e:a3:f9 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.35/24 brd 192.168.0.255 scope global eth4
valid_lft forever preferred_lft forever
inet 192.168.0.40/24 brd 192.168.0.255 scope global secondary eth4:1
valid_lft forever preferred_lft forever
inet 192.168.0.36/24 brd 192.168.0.255 scope global secondary eth4:3
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:a3f9/64 scope link
valid_lft forever preferred_lft forever
六:修改Private网卡名称,ip
修改之前网络信息:《============eth3
100.16.0.23
100.16.0.24
2: eth5: mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:50:56:8e:71:9f brd ff:ff:ff:ff:ff:ff
3: eth3: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:50:56:8e:48:2b brd ff:ff:ff:ff:ff:ff
inet 100.16.0.23/24 brd 100.16.0.255 scope global eth3
valid_lft forever preferred_lft forever
inet 169.254.199.73/16 brd 169.254.255.255 scope global eth3:1
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:482b/64 scope link
valid_lft forever preferred_lft forever
修改之后网络信息:《============eth5
10.10.10.123
10.10.10.124
1,修改网络接口信息
[grid@host01 ~]$ oifcfg setif -global eth5/10.10.10.0:cluster_interconnect
[grid@host01 ~]$ oifcfg getif
eth3 100.16.0.0 global cluster_interconnect
eth4 192.168.0.0 global public
eth5 10.10.10.0 global cluster_interconnect
2,关闭crs
3,修改主机网卡IP信息
4,启动crs
5,删除多余网络接口信息
[grid@host01 ~]$ oifcfg getif
eth3 100.16.0.0 global cluster_interconnect
eth4 192.168.0.0 global public
eth5 10.10.10.0 global cluster_interconnect
[grid@host01 ~]$ oifcfg delif -global eth3
[grid@host01 ~]$ oifcfg getif
eth4 192.168.0.0 global public
eth5 10.10.10.0 global cluster_interconnect
附录:
子网掩码地址,在使用oifcfg 需要计算subnet。
Name:
oifcfg - Oracle Interface Configuration Tool.
Usage: oifcfg iflist [-p [-n]]
oifcfg setif {-node <nodename> | -global} {<if_name>/<subnet>:<if_type>}...
subnet计算命令:
这是按照子网掩码252计算的网络配置,一会打算使用这个值模拟错误:
[root@lunar ~]# ipcalc -bnm 10.10.10.100 255.255.252.0
NETMASK=255.255.252.0
BROADCAST=10.10.11.255
NETWORK=10.10.8.0
IP地址 192.168.0.1
子网掩码 255.255.255.0
AND运算(AND运算法则:1 与1 = 1 ,1 与0 = 0 ,0 与1 = 0 ,0 与0 = 0 ,即当对应位均为1时结果为1,其余为0。)
转化为二进制进行运算:
I P 地址 11000000.10101000.00000000.00000001
子网掩码 11111111.11111111.11111111.00000000
AND运算
11000000.10101000.00000000.00000000
转化为十进制后为:
192.168.0.0 <==========该地址为oifcfg需要的地址。