背景:RAC测试环境停掉一段时间后重启发现IP和其它环境IP冲突,所以决定修改RAC测试环境的IP地址
操作系统版本:redhat 5.2
oracle版本:ORACLE 10.2.0.4 +ASM
IP 地址做如下修改:
Public IP 172.16.27.251/252 -- > 172.16.27.3/4
Privite IP 192.168.0.11/12 -- > 192.168.0.11/12
Virtual IP 172.16.27.253/254 -- > 172.16.27.3/4
1.停止oracle相关的所有进程, 包括数据库, asm, node application, crs本身.
查看当前系统上crs运行的状态
[oracle@node1 ~]$ 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.racdb.db application OFFLINE OFFLINE
ora....b1.inst application OFFLINE OFFLINE
ora....b2.inst application OFFLINE OFFLINE
2 停用crs
[root@node2 ~]# /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.
3 修改 /etc/hosts 文件。 保持2个节点的一致
[oracle@node1 ~]$ more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
172.16.27.3 node1
172.16.27.4 node2
172.16.27.5 node1-vip
172.16.27.6 node2-vip
192.168.0.11 node1-priv
192.168.0.12 node2-priv
[oracle@node1 ~]$
4 修改IP地址
--节点1
[root@node1 ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
NBOOT=yes
BOOTPROTO=none
HWADDR=00:0c:29:7b:b3:4c
NETMASK=255.255.0.0
IPADDR=172.16.27.3
GATEWAY=172.16.30.1
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
[root@node1 ~]# more /etc/sysconfig/network-scripts/ifcfg-eth1
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth1
NBOOT=yes
BOOTPROTO=none
HWADDR=00:0c:29:7b:b3:56
TYPE=Ethernet
NETMASK=255.255.0.0
IPADDR=192.168.0.11
USERCTL=no
IPV6INIT=no
PEERDNS=yes
[root@node1 ~]#
节点2
[root@node2 ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
NBOOT=yes
BOOTPROTO=none
HWADDR=00:0c:29:1f:22:6e
TYPE=Ethernet
NETMASK=255.255.0.0
IPADDR=172.16.27.4
GATEWAY=172.16.30.1
USERCTL=no
IPV6INIT=no
PEERDNS=yes
[root@node2 ~]# more /etc/sysconfig/network-scripts/ifcfg-eth1
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth1
NBOOT=yes
BOOTPROTO=none
HWADDR=00:0c:29:1f:22:78
TYPE=Ethernet
NETMASK=255.255.0.0
IPADDR=192.168.0.12
USERCTL=no
IPV6INIT=no
PEERDNS=yes
[root@node2 ~]#
5 在两个节点上分别重启网络服务,使修改的IP生效。
[root@node1 bin]# service network restart
[root@node2 bin]# service network restart
6. 启动crs, 设置oracle中ip地址相关的设置.
在两个节点启动crs, 并关闭随crs启动的应用程序
[root@node1 bin]# /etc/init.d/init.crs start
Startup will be queued to init within 90 seconds.
[root@node2 bin]# /etc/init.d/init.crs start
Startup will be queued to init within 90 seconds.
7.由于oracle所有应用设置为自动启动, 所以在crs启动时会试图启动所有的服务, 但是在对oracle相关的ip地址进行设置时需要crs处于运行状态. 但是数据库, asm和node application处于停止状态,
使用crs_stop -f把数据库相关的服务停掉
如:
[oracle@node2 ~]$ crs_stop -f ora.node1.ons
Attempting to stop `ora.node1.ons` on member `node1`
Stop of `ora.node1.ons` on member `node1` succeeded.
最后查看状态
[oracle@node1 ~]$ crs_stat2
HA Resource Target State
---------- ---- ----
ora.node1.ASM1.asm OFFLINE OFFLINE
ora.node1.LISTENER_NODE1.lsnr OFFLINE OFFLINE
ora.node1.gsd OFFLINE OFFLINE
ora.node1.ons OFFLINE OFFLINE
ora.node1.vip OFFLINE OFFLINE
ora.node2.ASM2.asm OFFLINE OFFLINE
ora.node2.LISTENER_NODE2.lsnr OFFLINE OFFLINE
ora.node2.gsd OFFLINE OFFLINE
ora.node2.ons OFFLINE OFFLINE
ora.node2.vip OFFLINE OFFLINE
ora.racdb.db OFFLINE OFFLINE
ora.racdb.racdb1.inst OFFLINE OFFLINE
ora.racdb.racdb2.inst OFFLINE OFFLINE
8.使用oifcfg修改网卡设置, oifconfig可以用来设置和查看网卡使用的方式.
注: 如果修改的网段相同,可以不做这一步。
-- 查看当前配置:
[root@node1 bin]# oifcfg getif -global
eth0 172.16.0.0 global public
eth1 192.168.0.0 global cluster_interconnect
--删除当前配置
[root@node1 bin]# ./oifcfg delif -global eth0
[root@node1 bin]# ./oifcfg delif -global eth1
--添加当前配置
[root@node1 bin]# ./oifcfg setif -global eth0/172.16.0.0:public
[root@node1 bin]# ./oifcfg setif -global eth1/192.168.0.0:cluster_interconnect
[root@node1 bin]# oifcfg getif -global
eth0 172.16.0.0 global public
eth1 192.168.0.0 global cluster_interconnect
9. 修改VIP
[root@node1 bin]# srvctl modify nodeapps -n node1 -A 172.16.27.5/255.255.255.0/eth0
[root@node1 bin]# srvctl modify nodeapps -n node2 -A 172.16.27.6/255.255.255.0/eth0
10.设置listener.ora和tnsnames.ora, 检查这些文件中是否有指定原来ip的地方, 修改为更改后的ip地址
[oracle@node2 admin]$ vi listener.ora
# listener.ora.node2 Network Configuration File: /opt/ora10g/product/10.2.0/db_1/network/admin/listener.ora.node2
# Generated by Oracle configuration tools.
LISTENER_NODE2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = node2-vip)(PORT = 1521)(IP = FIRST))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.27.4)(PORT = 1521)(IP = FIRST))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
)
)
11.启动数据库
[oracle@node2 admin]$ crs_start -all
[oracle@node1 ~]$ crs_stat2
HA Resource Target State
---------- ---- ----
ora.node1.ASM1.asm ONLINE ONLINE on node1
ora.node1.LISTENER_NODE1.lsnr ONLINE ONLINE on node1
ora.node1.gsd ONLINE ONLINE on node1
ora.node1.ons ONLINE ONLINE on node1
ora.node1.vip ONLINE ONLINE on node1
ora.node2.ASM2.asm ONLINE ONLINE on node2
ora.node2.LISTENER_NODE2.lsnr ONLINE ONLINE on node2
ora.node2.gsd ONLINE ONLINE on node2
ora.node2.ons ONLINE ONLINE on node2
ora.node2.vip ONLINE ONLINE on node2
ora.racdb.db ONLINE ONLINE on node1
ora.racdb.racdb1.inst ONLINE ONLINE on node1
ora.racdb.racdb2.inst ONLINE ONLINE on node2
[oracle@node1 ~]$