rac修改ip地址的方法

分类:编程技术 时间:2024-02-20 15:51 浏览:0 评论:0
0
小编给大家分享一下RAC中如何更改IP地址。相信大多数人对此还不是很了解,所以分享这篇文章供大家参考。希望您读完这篇文章后能有所收获。我们一起来了解一下吧。试一试!



oracle发布11.2.0.4.0
本实验模式netmask:255.255.255.0


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




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


私有网络配置不仅仅存在 ocr ,还有 gpnp 配置文件,所以需要后台首先up profile.xml:
[grid@host01对等点]$ pwd
/u01/11.2.0/grid/gpnp/host01/profiles/peer
/>[grid@host01对等点] $ 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 2023/03/29 08:48:19 /u01/11.2.0/grid/ cdata/host-cluster /backup_20230329_084819.ocr
[root@host01 ~]# /u01/11.2.0/grid/bin/ocrconfig -showbackup


host02 2023/03 /29 06:08 :55 /u01/11.2.0/grid/cdata/host-cluster/backup00.ocr


host02 2023/03/29 02:08:55 /u01 /11.2.0/ grid/cdata/host-cluster/backup01.ocr


host02 2023/03/28 22:08:54 /u01/11.2.0/grid/cdata/主机集群/backup02 .ocr


host02 2023/03/28 22:08:54 /u01/11.2.0/grid/cdata/host-cluster/day.ocr



host02 2023/03 /28 22:08:54 /u01/11.2.0/grid/cdata/host-cluster/week.ocr


host02 2023/03 /29 08:48:19 /u01 /11.2.0/grid/cdata/host-cluster/backup_20230329_084819.ocr


hosts配置文件备份:


cp /etc/hosts /tmp/hosts.bak0329


********************************
/>场景一
********************************
修改主机ip、vip、扫描(网卡名称不变)
修改前:
#192.168.0.35host01
#192.168.0.36host01-vip
#192.168.0.38host02
#192.168 .0.39host02- vip
#192.168.0.40scan
修改后:
172.16.0.135host01
172.16.0.136host01-vip
172.16.0.138host02
172.16.0.139 host02-vip
172.16.0.140扫描




1.正常关机、监控及CRS
###### /u01/11.2.0/grid/bin/crsctl stop crs
2.修改/etc/hosts配置文件
172.16.0.135host01
172.16.0.136host01-vip
172.16 .0.138host02
172.16.0.139host02-vip
172.16.0.140扫描
3. OS层修改公网网卡地址


4.启动crs
######/u01/11.2.0/grid/bin/crsctl启动crs
5.修改公网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 全局公共
eth5 10.168.0.0 globalcluster_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 全局 cluster_interconnect
eth4 172.16.0.0 全局公共




6.修改VIP--停止数据库和监控
srvctl stop vip -n host01
srvctl stop vip -n host02


#root用户修改:
srvctl修改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存在:/172.16.0.136/172.16.0.136/172.16.0.0/255.255.255.0/eth4,托管节点host01
[root@host01 ~]# /u01/11.2.0/grid /bin/srvctl config vip -n host02
VIP存在:/host02-vip/172.16.0.139/172.16.0.0/255.255.255.0/eth4,托管节点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参数local_listener
--修改:
alter system set local_listener='(ADDRESS=(PROTOCOL =TCP)(HOST=172.16.0.136)(PORT=1521))' sid='orcl1';
更改系统设置 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 修改 scan -n scan
/u01/11.2. 0/grid/bin/srvctl config scan
SCAN名称:scan,网络:1/172.16.0.0/255.255.255.0/eth4
SCAN VIP名称:scan1,IP:/scan/172.16.0.140< br/>

/u01/11.2.0/grid/bin/srvctl 启动扫描
/u01/11.2.0/grid/bin/srvctl 启动 scan_listener




********************************
场景2< br/ />********************************
修改私有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 ~]$
##新子网有相同的n网络卡名称,但子网不同:
[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 停止 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 全局 cluster_interconnect
eth6 172.16.0.0 全局公共

< br/>



*******************************
/>场景3
**************** *************
公网网卡名称eth4===> eth6


1、修改网卡信息
[grid @host01 ~]$ oifcfg getif
eth5 10.168.0.0 global cluster_interconnect
eth5 100.16.0.0 全局 cluster_interconnect
eth4 172.16.0.0 全局 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 全局 cluster_interconnect
eth5 100.16.0.0 全局 cluster_interconnect
eth4 172.16.0.0 全局公共
eth6 172.16.0.0 全局公共
[grid@host01 ~]$ oifcfg delif -global eth4/ 172.16.0.0:public
[grid@host01 ~]$ oifcfg getif
eth5 10.168.0.0 全局 cluster_interconnect
eth5 100.16.0.0 全局 cluster_interconnect
eth6 172.16.0.0 全局 public
/>

2.停止crs
3。修改操作系统网卡名称
4.启动crs
5。修改vip,扫描
#root执行
srvctl stop vip -n host01
srvctl stop vip -n host02
srvctl修改nodeapps -n host01 -A 172.16.0.136/255.255.255.0 /eth6
srvctl 修改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存在: /172.16.0.136/172.16.0.136/172.16.0.0/255.255.255.0/eth6,托管节点host01
[root@host01 host01]# /u01/11.2.0/grid/bin/srvctl config vip -n host02
VIP存在:/host02-vip/172.16.0.139/172.16.0.0/255.255.255.0/eth6,托管节点host02


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


******** * ******************
场景 4
******************** ****************


修改私网网卡名称eth5===>eth4


1、添加新的网络信息
[grid@host01 ~]$ < br/>[grid@host01 ~]$ oifcfg setif -global eth4/100.16.0.0:cluster_interconnect
[grid@host01 ~] ]$ oifcfg getif
eth5 100.16.0.0 全局 cluster_interconnect
eth6 172.16 .0.0 全局 public
eth4 100.16.0.0 全局 cluster_interconnect


2、停止 crs
3、莫迪fy主机网卡信息
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 全局 public
eth4 100.16 .0.0 全局 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 作用域主机 lo
valid_lft 永远 Preferred_lft 永远
inet6::1/128 作用域主机
valid_lft永远首选_lft永远
2:eth6:<广播,多播,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast状态UP qlen 1000
链接/以太00:50:56:8e:06:87 brd ff:ff : ff:ff:ff:ff
inet172.16.0.138/24 brd 172.16.0.255 范围全局 eth6
valid_lft 永远 Preferred_lft 永远
inet6 fe80::250:56ff:fe8e:687/64 范围链接
Valid_lft 永远 Preferred_lft 永远
3: eth4: <广播、组播> mtu 1500 qdisc pfifo_fast 状态 DOWN qlen 1000
link/ether 00:50:56:8e:8c:39 brd ff:ff:ff:ff:ff:ff
4: eth5: <广播、组播、UP、LOWER_UP> mtu 1500 qdisc pfifo_fast 状态 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 作用域全局 eth5
valid_lft 永远 Preferred_lft 永远
inet6 fe80::250:56ff:fe8e:2d83/64 作用域链接
valid_lft 永远 Preferred_lft 永远


========== ====
修改后
[root@host02 network-scripts]# ip a s
1:lo: mtu 65536 qdisc noqueue状态未知
链接/环回00:00:00:00:00:00 brd 00:00:00:00: 00:00
inet 127.0.0.1/8 范围主机 lo
valid_lft 永远 Preferred_lft 永远
inet6::1/128 范围主机
valid_lft 永远 Preferred_lft 永远
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 范围全局 eth6
                                                                                                              valid_lft 永远首选_lft 永远
        inet6 fe80::250:56ff:fe8e:687/64 范围链接 
             : eth4: mtu 1500 qdisc pfifo_fast 状态 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 范围全局 eth4
valid_lft 永远 Preferred_lft 永远
inet6 fe80::250:56ff:fe8e:8c39/64 范围链接
valid_lft 永远 Preferred_lft 永远
4: eth5: <广播,组播> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether 00:50:56:8e:2d:83brd ff:ff:ff:ff:ff:ff
== =======




*****************************
五:修改公网网卡名称、ip
/>**************** ****************
修改前:<<<====== ====eth6


172.16 .0.135host01
172.16.0.136host01-vip
172.16.0.138host02
172.16.0.139host02-vip< br/>172.16.0.140scan


[root@host01 network-scripts]# ip a s
1: lo: mtu 65536 qdisc 无队列状态未知
link/loopback 00:00:00:00:00: 00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 范围主机 lo
valid_lft 永远Preferred_lft 永远
inet6 ::1/128 范围主机
valid_lft 永远 Preferred_lft 永远
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 范围全局 eth6
                                                                                                               的。 2.16.0.255 范围全球第二ry Eth6: 2
Valid_lft 永远 Preferred_lft 永远
Inbet6 Fe80 :: 250: 56FF: 719F/64 范围链接
Valid_lft 永远 P Referred_lft 永远
3: ETH4: < 广播、组播,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast 状态 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 范围全局 eth4:1 valid_lft 永远 Preferred_lft 永远
inet6 fe80::250:56ff:fe8e:482b/64 范围链接
valid_lft 永远 Preferred_lft 永远
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.35host01
192.168.0.36host01-vip
192.168.0.38host02< br/>192.168.0.39host02-vip
192.168.0.40scan


1、停止crs
2、修改hosts
3、修改host 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 全局公共
eth4 100.16.0.0 全局 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 全局cluster_interconnect
eth5 192.168.0.0 global public




6、修改vip,扫描地址
#root用户修改:
srvctl stop vip -n host01
srvctl stop vip -n host02


#root用户修改:
srvctl修改nodeapps -n host01 -A 192.168.0.36/ 255.255.255.0/eth5
srvctl修改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参数local_listener
--修改:
alter system set local_listener='(ADDRESS=(PROTOCOL =TCP)(HOST= host01-vip)(PORT=1521))' sid='orcl1';
更改系统设置 local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST= host02-vip)(PORT =1521))' sid='orcl2';




#修改扫描
srvctl stop scan_listener
srvctl stop scan
srvctl status scan_listener
srvctl status scan
#root
/u01/11.2.0/grid/bin/srvctl edit scan -n scan
/u01/11.2.0/ grid/bin/srvctl config scan
SCAN 名称:scan,网络:1/192.168.0.0/255.255.255.0/eth5
SCAN VIP 名称:scan1,IP :/scan/192.168.0.40


/u01/11.2.0/grid/bin/srvctl 启动扫描
/u01/11.2.0/grid/bin/srvctl 启动 scan_listener

< br/>修改后的IP地址信息:
[root@host01 network-scripts]# ip a s
1:lo: mtu 65536 qdisc noqueue状态未知
链接/环回00:00:00:00:00:00 brd 00:00:00:00:00: 00
inet 127.0.0.1/8 范围主机 lo
inet6 ::1/128 范围主机
valid_lft 永远 Preferred_lft 永远
2: eth6: <广播、组播> mtu 1500 qdisc pfifo_fast 状态 DOWN qlen 1000
link/ether 00:50:56:8e:71:9f brd ff:ff:ff:ff:ff:ff
3: eth4 : <广播、组播、UP、LOWER_UP> mtu 1500 qdisc pfifo_fast 状态 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 范围全局 eth4
Valid_lft 永远首选_lft 永远
inet 169.254.199.73/16 brd 169.254.255.255 范围全局 eth4:1
Valid_lft 永远首选_lft 永远
inet6 fe80::250:56ff:fe8e :482b /64 范围链接
valid_lft 永远 Preferred_lft 永远
4: eth5: mtu 1500 qdisc pfifo_fast 状态 UP qlen 1000
里nk/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 范围全局 eth5
valid_lft 永远首选_lft永远
inet192.168.0.40/24 BRD 192.168.0.255 范围全球次要 Eth5:1
Valid_lft 永远 Preferred_lft 永远
Inte 192.168.0.36/24 BRD 192.168.0.2 55 范围全球次要 Eth5: 3
Valid_lft 永远 Preferred_lft 永远
inet6 fe80::250:56ff:fe8e:a3f9/64 范围链接
valid_lft 永远 Preferred_lft 永远


** ******** *****************
六:修改私有网卡名称、ip
***** ****************** **********
修改之前的网络信息:“============ eth4
100.16.0.23
100.16.0.24


2:eth6:<广播,组播> mtu 1500 qdisc pfifo_fast状态DOWN qlen 1000
链接/以太 00:50:56:8e:71:9f brd ff:ff:ff :ff:ff:ff
3: eth4: <广播、组播、UP、LOWER_UP> mtu 1500 qdisc pfifo_fast 状态 UP qlen 1000< br/> 链接/以太 00:50:56:8e:48:2b brd ff:ff:ff:ff:ff:ff
inet 100.16.0.23/24 brd 100.16.0.255 范围全局 eth4:1 :fe8e :482b/64 范围链接
Valid_lft 永远 Preferred_lft 永远


修改后的网络信息:“============eth6
10.10 .10.123
10.10.10.124
< br/>
1.修改网络接口信息
[grid@host01 ~]$ oifcfg setif -global eth6/10.10.10.0:cluster_interconnect< br/>[grid@host01 ~]$ oifcfg getif< br/>eth4 100.16.0.0 全局 cluster_interconnect
eth5 192.168.0.0 全局 public
eth6 10.10.10.0 全局 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 全局公共
eth6 10.10.10.0 全局 cluster_interconnect
[grid@host01 ~]$ oifcfg delif -global eth4
[grid@host01 ~]$ oifcfg getif< br/>eth5 192.168.0.0 全球酒吧lic
eth6 10.10.10.0 全局 cluster_interconnect






附录:

< br/>子网掩码 代码地址,使用oifcfg时需要计算子网。
名称:
oifcfg - Oracle 接口配置工具。


用法:oifcfg iflist [-p [-n]]
oifcfg setif {-node <节点名称> | -global} {/:}...


IP 地址 192.168.0.1
子网掩码 255.255。 255.0
与运算(与运算规则:1和1 = 1、1和0 = 0、0和1 = 0、0和0 = 0,即对应位都为1时,结果为1,其余均为0。)
转换为二进制进行运算:
IP地址11000000.10101000.00000000.00000001
子网掩码11111111.11111111.11111111.00000000
与运算
11000000.1 0101000.00000000。 00000000
转成十进制后:
192.168.0.0 <==========这个地址就是oifcfg需要的地址。

以上就是本次的全部内容文章“如何更改 RAC 中的 IP 地址”。感谢您的阅读!相信大家都有一定的了解。希望分享的内容对大家有所帮助。如果您想了解更多知识,请关注行业资讯频道!

1. 本站所有资源来源于用户上传或网络,仅作为参考研究使用,如有侵权请邮件联系站长!
2. 本站积分货币获取途径以及用途的解读,想在本站混的好,请务必认真阅读!
3. 本站强烈打击盗版/破解等有损他人权益和违法作为,请各位会员支持正版!
4. 编程技术 > rac修改ip地址的方法

用户评论