千家信息网

rac如何修改ip地址

发表于:2024-11-26 作者:千家信息网编辑
千家信息网最后更新 2024年11月26日,小编给大家分享一下rac如何修改ip地址,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!oracle release 11.
千家信息网最后更新 2024年11月26日rac如何修改ip地址

小编给大家分享一下rac如何修改ip地址,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!



oracle release 11.2.0.4.0
本次实验模式netmask:255.255.255.0


一:修改主机ip,vip,scan(网卡名称不变)
二:修改Private IP
三:修改公网网卡名称,ip地址不变
四:修改Private网卡名称,ip地址不变
五:修改公网网卡名称,ip
六:修改Private网卡名称,ip
附录:子网掩码地址计算




*****************************
*****************************
备份:2台主机:


私有网络配置不仅仅存在ocr中,还存在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 ~]#
[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


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
eth4 172.16.0.0
eth5 10.168.0.0
eth5 169.254.0.0


[grid@host01 ~]$ oifcfg getif
eth4 192.168.0.0 global public
eth5 10.168.0.0 global cluster_interconnect
[grid@host01 ~]$ oifcfg delif -global eth4
[grid@host01 ~]$ oifcfg setif -global eth4/172.16.0.0:public
[grid@host01 ~]$ oifcfg getif
eth5 10.168.0.0 global cluster_interconnect
eth4 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/eth4
srvctl modify nodeapps -n host02 -A 172.16.0.139/255.255.255.0/eth4


[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/eth4, 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/eth4, 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信息:
检查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/eth4
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--eth5
10.168.0.124/24--eth5
修改后地址
100.16.0.23/24--eth5
100.16.0.24/24--eth5




1,添加新的网络信息
[grid@host01 ~]$ oifcfg getif
eth5 10.168.0.0 global cluster_interconnect
eth4 192.168.0.0 global public
[grid@host01 ~]$
##新的子网具有相同网卡的名称但不同的子网:
[grid@host01 ~]$ oifcfg setif -global eth5/100.16.0.0:cluster_interconnect
[grid@host01 ~]$ oifcfg getif
eth5 10.168.0.0 global cluster_interconnect
eth5 100.16.0.0 global cluster_interconnect
eth4 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 eth5/10.168.0.0
[grid@host01 ~]$ oifcfg getif
eth5 100.16.0.0 global cluster_interconnect
eth6 172.16.0.0 global public






*****************************
情景三
*****************************
公网网卡名称 eth4===>eth6


1,修改网卡信息
[grid@host01 ~]$ oifcfg getif
eth5 10.168.0.0 global cluster_interconnect
eth5 100.16.0.0 global cluster_interconnect
eth4 172.16.0.0 global public
[grid@host01 ~]$ oifcfg iflist
eth6 172.16.0.0
eth5 100.16.0.0
eth5 169.254.0.0
[grid@host01 ~]$ oifcfg setif -global eth6/172.16.0.0:public
[grid@host01 ~]$ oifcfg getif
eth5 10.168.0.0 global cluster_interconnect
eth5 100.16.0.0 global cluster_interconnect
eth4 172.16.0.0 global public
eth6 172.16.0.0 global public
[grid@host01 ~]$ oifcfg delif -global eth4/172.16.0.0:public
[grid@host01 ~]$ oifcfg getif
eth5 10.168.0.0 global cluster_interconnect
eth5 100.16.0.0 global cluster_interconnect
eth6 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/eth6
srvctl modify nodeapps -n host02 -A 172.16.0.139/255.255.255.0/eth6


[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/eth6, 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/eth6, 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网卡名称 eth5===>eth4


1,添加新的网络信息
[grid@host01 ~]$
[grid@host01 ~]$ oifcfg setif -global eth4/100.16.0.0:cluster_interconnect
[grid@host01 ~]$ oifcfg getif
eth5 100.16.0.0 global cluster_interconnect
eth6 172.16.0.0 global public
eth4 100.16.0.0 global cluster_interconnect


2,停止crs
3,修改主机网卡信息
4,启动crs
5,删除多余网络信息
[grid@host01 ~]$ oifcfg getif
eth5 100.16.0.0 global cluster_interconnect
eth6 172.16.0.0 global public
eth4 100.16.0.0 global cluster_interconnect
[grid@host01 ~]$ oifcfg delif -global eth5/100.16.0.0
[grid@host01 ~]$ oifcfg getif
eth6 172.16.0.0 global public
eth4 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: eth6: 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 eth6
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:687/64 scope link
valid_lft forever preferred_lft forever
3: eth4: 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: eth5: 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 eth5
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: eth6: 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 eth6
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:687/64 scope link
valid_lft forever preferred_lft forever
3: eth4: 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 eth4
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:8c39/64 scope link
valid_lft forever preferred_lft forever
4: eth5: 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
***************************
修改之前:<<<==========eth6


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: eth6: 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 eth6
valid_lft forever preferred_lft forever
inet 172.16.0.136/24 brd 172.16.0.255 scope global secondary eth6:3
valid_lft forever preferred_lft forever
inet 172.16.0.140/24 brd 172.16.0.255 scope global secondary eth6:2
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:719f/64 scope link
valid_lft forever preferred_lft forever
3: eth4: 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 eth4
valid_lft forever preferred_lft forever
inet 169.254.199.73/16 brd 169.254.255.255 scope global eth4:1
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:482b/64 scope link
valid_lft forever preferred_lft forever
4: eth5: mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:50:56:8e:a3:f9 brd ff:ff:ff:ff:ff:ff


修改之后:<<<==========eth5
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
eth4 100.16.0.0
eth4 169.254.0.0
eth5 192.168.0.0


[grid@host01 ~]$ oifcfg getif
eth6 172.16.0.0 global public
eth4 100.16.0.0 global cluster_interconnec
[grid@host01 ~]$ oifcfg delif -global eth6
[grid@host01 ~]$ oifcfg setif -global eth5/192.168.0.0:public
[grid@host01 ~]$ oifcfg setif -global eth5/192.168.0.0:public
[grid@host01 ~]$ oifcfg getif
eth4 100.16.0.0 global cluster_interconnect
eth5 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/eth5
srvctl modify nodeapps -n host02 -A 192.168.0.39/255.255.255.0/eth5


/u01/11.2.0/grid/bin/srvctl start vip -n host01
/u01/11.2.0/grid/bin/srvctl start vip -n host02




确认local_listener信息:
检查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/eth5
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: eth6: 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: eth4: 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 eth4
valid_lft forever preferred_lft forever
inet 169.254.199.73/16 brd 169.254.255.255 scope global eth4:1
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:482b/64 scope link
valid_lft forever preferred_lft forever
4: eth5: 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 eth5
valid_lft forever preferred_lft forever
inet 192.168.0.40/24 brd 192.168.0.255 scope global secondary eth5:1
valid_lft forever preferred_lft forever
inet 192.168.0.36/24 brd 192.168.0.255 scope global secondary eth5:3
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:a3f9/64 scope link
valid_lft forever preferred_lft forever


***************************
六:修改Private网卡名称,ip
***************************
修改之前网络信息:《============eth4
100.16.0.23
100.16.0.24


2: eth6: 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: eth4: 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 eth4
valid_lft forever preferred_lft forever
inet 169.254.199.73/16 brd 169.254.255.255 scope global eth4:1
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:fe8e:482b/64 scope link
valid_lft forever preferred_lft forever


修改之后网络信息:《============eth6
10.10.10.123
10.10.10.124


1,修改网络接口信息
[grid@host01 ~]$ oifcfg setif -global eth6/10.10.10.0:cluster_interconnect
[grid@host01 ~]$ oifcfg getif
eth4 100.16.0.0 global cluster_interconnect
eth5 192.168.0.0 global public
eth6 10.10.10.0 global cluster_interconnect


2,关闭crs
3,修改主机网卡IP信息
4,启动crs
5,删除多余网络接口信息
[grid@host01 ~]$ oifcfg getif
eth4 100.16.0.0 global cluster_interconnect
eth5 192.168.0.0 global public
eth6 10.10.10.0 global cluster_interconnect
[grid@host01 ~]$ oifcfg delif -global eth4
[grid@host01 ~]$ oifcfg getif
eth5 192.168.0.0 global public
eth6 10.10.10.0 global cluster_interconnect






附录:


子网掩码地址,在使用oifcfg 需要计算subnet。
Name:
oifcfg - Oracle Interface Configuration Tool.


Usage: oifcfg iflist [-p [-n]]
oifcfg setif {-node | -global} {/:}...


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需要的地址。

以上是"rac如何修改ip地址"这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注行业资讯频道!

0