Oracle10gRAC修改IP/VIP地址示例-创新互联
一、准备工作
1. 数据库信息
操作系统版本 : OEL5.4 x64
数据库版本 : Oracle 10.2.0.5 x64 RAC
2. IP地址对应信息
说明: 服务器主机名不能更改,如确实要改名,需要重装CRS解决,还不如重新安装呢。
本文环境是10g rac+ocfs+asm,心跳地址不变,IP地址因环境限制暂时采用同一个网段,不同的IP地址,但是过程与不同网段改名一致。
原IP地址:
192.168.0.6 node1 修改为: 192.168.0.206
192.168.0.7 node2 修改为: 192.168.0.207
192.168.0.8 node1-vip 修改为: 192.168.0.208
192.168.0.9 node2-vip 修改为: 192.168.0.209
10.10.10.10 node1-priv 不变
10.10.10.20 node2-priv 不变
调整后IP地址:
192.168.0.206 node1
192.168.0.207 node2
192.168.0.208 node1-vip
192.168.0.209 node2-vip
10.10.10.10 node1-priv
10.10.10.20 node2-priv
二、停止oracle rac服务。
1. 关闭ORACLE RAC进程, 可在任一节点上执行,这里采用节点1.
[root@node1 ~]# cd /u01/app/oracle/product/10.2.0/crs/bin
[root@node1 ~]# pwd
/u01/app/oracle/product/10.2.0/crs/bin
# 依次关闭数据库, asm, node application, crs
[root@node1 bin]# ./srvctl stop database -d orcl
[root@node1 bin]# ./srvctl stop asm -n node1
[root@node1 bin]# ./srvctl stop asm -n node2
[root@node1 bin]# ./srvctl stop nodeapps -n node1
[root@node1 bin]# ./srvctl stop nodeapps -n node2
# 查看关闭情况
[root@node1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application OFFLINE OFFLINE
ora....E1.lsnr application OFFLINE OFFLINE
ora.node1.gsd application OFFLINE OFFLINE
ora.node1.ons application OFFLINE OFFLINE
ora.node1.vip application OFFLINE OFFLINE
ora....SM2.asm application OFFLINE OFFLINE
ora....E2.lsnr application OFFLINE OFFLINE
ora.node2.gsd application OFFLINE OFFLINE
ora.node2.ons application OFFLINE OFFLINE
ora.node2.vip application OFFLINE OFFLINE
ora.orcl.db application OFFLINE OFFLINE
ora....l1.inst application OFFLINE OFFLINE
ora....l2.inst application OFFLINE OFFLINE
2. 关闭crs后台进程
#注:必须在所有(node1,node2)节点上root用户执行。
[root@node1 bin]# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
[root@node2 bin]# /etc/init.d/init.crs stop
Shutting down Oracle Cluster Ready Services (CRS):
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
三、 修改服务器IP地址
1. node1,node2 修改 /etc/hosts 文件。 保持2个节点的一致
[root@node1 bin]# vi /etc/hosts
192.168.0.206 node1
192.168.0.207 node2
192.168.0.208 node1-vip
192.168.0.209 node2-vip
10.10.10.10 node1-priv
10.10.10.20 node2-priv
2. 在两个节点上分别修改eth0地址、网关,心跳地址不变,不改动。
node1节点:
[root@node1 bin]# more /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:0C:29:EA:C7:1F
IPADDR=192.168.0.206
NETMASK=255.255.255.0
ONBOOT=yes
node2节点:
[root@node2 bin]# more /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
ONBOOT=yes
IPADDR=192.168.0.207
NETMASK=255.255.255.0
HWADDR=00:0c:29:6c:08:aa
3. 重启网络服务
# service network restart
# service network restart
四、启动crs.
1. 在两个节点(node1,node2)启动crs, 并关闭随crs启动的服务
[root@node1 bin]# /etc/init.d/init.crs start
Startup will be queued to init within 30 seconds.
[root@node2 bin]# /etc/init.d/init.crs start
Startup will be queued to init within 30 seconds.
#由于IP地址还未修改完成,一些服务器无法启动成功,需要关闭掉。
[root@node1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE OFFLINE
ora.node1.gsd application ONLINE OFFLINE
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE OFFLINE
ora.node2.gsd application ONLINE OFFLINE
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2
ora.orcl.db application ONLINE OFFLINE
ora....l1.inst application ONLINE OFFLINE
ora....l2.inst application ONLINE OFFLINE
#关闭所有服务
[root@node1 bin]# ./srvctl stop database -d orcl
[root@node1 bin]# ./srvctl stop asm -n node1
[root@node1 bin]# ./srvctl stop asm -n node2
[root@node1 bin]# ./srvctl stop nodeapps -n node1
[root@node1 bin]# ./srvctl stop nodeapps -n node2
#确认关闭
[root@node1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application OFFLINE OFFLINE
ora....E1.lsnr application OFFLINE OFFLINE
ora.node1.gsd application OFFLINE OFFLINE
ora.node1.ons application OFFLINE OFFLINE
ora.node1.vip application OFFLINE OFFLINE
ora....SM2.asm application OFFLINE OFFLINE
ora....E2.lsnr application OFFLINE OFFLINE
ora.node2.gsd application OFFLINE OFFLINE
ora.node2.ons application OFFLINE OFFLINE
ora.node2.vip application OFFLINE OFFLINE
ora.orcl.db application OFFLINE OFFLINE
ora....l1.inst application OFFLINE OFFLINE
ora....l2.inst application OFFLINE OFFLINE
[root@node1 bin]#
2. 使用oifcfg修改网卡设置, oifconfig可以用来设置和查看网卡使用的方式.
注: node1,node2上操作,如果修改的网段相同,可以不做,但是如果其它网段,可以按如下方式
#查看当前配置
[root@node1 bin]# ./oifcfg getif -global
eth0 192.168.0.0 global public
eth2 10.10.10.0 global cluster_interconnect
#删除当前配置
[root@node1 bin]# ./oifcfg delif -global eth0
[root@node1 bin]# ./oifcfg delif -global eth2
[root@node1 bin]# ./oifcfg getif
#重新添加,内联及心跳网段(对应IP地址子网掩码配置网段)
[root@node1 bin]# ./oifcfg setif -global eth0/192.168.0.0:public
[root@node1 bin]# ./oifcfg setif -global eth2/10.10.10.0:cluster_interconnect
[root@node1 bin]# ./oifcfg getif
eth0 192.168.0.0 global public
eth2 10.10.10.0 global cluster_interconnect
[root@node1 bin]# ./oifcfg iflist
eth0 192.168.0.0
eth2 10.10.10.0
3. node1,node2 修改VIP地址
[root@node1 bin]# ./srvctl modify nodeapps -n node1 -A 192.168.0.208/255.255.255.0/eth0
[root@node1 bin]# ./srvctl modify nodeapps -n node2 -A 192.168.0.209/255.255.255.0/eth0
4. node1,node2 设置listener.ora和tnsnames.ora
#查看原IP地址,修改为现在的IP地址。
[root@node1 bin]# vi /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
SID_LIST_LISTENER_NODE1 =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
)
LISTENER_NODE1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = node1-vip)(PORT = 1521)(IP = FIRST))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.206)(PORT = 1521)(IP = FIRST))
)
)
5. node1上操作,启动node 应用, asm, 数据库
[root@node1 bin]# ./srvctl start nodeapps -n node1
[root@node1 bin]# ./srvctl start nodeapps -n node2
[root@node1 bin]# ./srvctl start asm -n node1
[root@node1 bin]# ./srvctl start asm -n node2
[root@node1 bin]# ./srvctl start instance -d orcl -i orcl1
[root@node1 bin]# ./srvctl start instance -d orcl -i orcl2
[root@node1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....SM1.asm application ONLINE ONLINE node1
ora....E1.lsnr application ONLINE ONLINE node1
ora.node1.gsd application ONLINE ONLINE node1
ora.node1.ons application ONLINE ONLINE node1
ora.node1.vip application ONLINE ONLINE node1
ora....SM2.asm application ONLINE ONLINE node2
ora....E2.lsnr application ONLINE ONLINE node2
ora.node2.gsd application ONLINE ONLINE node2
ora.node2.ons application ONLINE ONLINE node2
ora.node2.vip application ONLINE ONLINE node2
ora.orcl.db application ONLINE ONLINE node2
ora....l1.inst application ONLINE ONLINE node1
ora....l2.inst application ONLINE ONLINE node2
若启动出现问题,再进行判断 。
6. 确认IP, 修改完成。
[root@node1 bin]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:EA:C7:1F
inet addr:192.168.0.206 Bcast:192.168.0.255 Mask:255.255.255.0
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:EA:C7:1F
inet addr:192.168.0.208 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth2 Link encap:Ethernet HWaddr 00:0C:29:EA:C7:29
inet addr:10.10.10.10 Bcast:10.10.10.255 Mask:255.255.255.0
[root@node2 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:6C:08:AA
inet addr:192.168.0.207 Bcast:192.168.0.255 Mask:255.255.255.0
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:6C:08:AA
inet addr:192.168.0.209 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth2 Link encap:Ethernet HWaddr 00:0C:29:6C:08:B4
inet addr:10.10.10.20 Bcast:10.10.10.255 Mask:255.255.255.0
7. 重启节点测试,rac启动均正常,无问题。
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
当前题目:Oracle10gRAC修改IP/VIP地址示例-创新互联
分享URL:http://cdiso.cn/article/dsocgg.html