您好,登錄后才能下訂單哦!
小編給大家分享一下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: <LOOPBACK,UP,LOWER_UP> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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: <BROADCAST,MULTICAST> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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: <LOOPBACK,UP,LOWER_UP> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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: <BROADCAST,MULTICAST> 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: <LOOPBACK,UP,LOWER_UP> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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: <BROADCAST,MULTICAST> 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: <LOOPBACK,UP,LOWER_UP> 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: <BROADCAST,MULTICAST> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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: <BROADCAST,MULTICAST> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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 <nodename> | -global} {<if_name>/<subnet>:<if_type>}...
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地址”這篇文章的所有內容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內容對大家有所幫助,如果還想學習更多知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。