分类: Oracle
2012-12-26 10:53:07
在做之前,要手动的OCR 进行一个备份, 这样即使修改失败,也能还原回来。 OCR的备份,参考Blog:
Oracle 10g RAC OCR 和 VotingDisk 的备份与恢复
http://blog.csdn.net/tianlesoftware/archive/2010/04/09/5467273.aspx
另外,Public/Private对应的的主机名不能更改,如果确实需要更改主机名,需要重新安装CRS。
实验对IP 地址做如下修改:
Public IP 10.85.10.119/121 -- > 10.85.10.219/221
Privite IP 192.168.1.119/121 -- > 192.168.1.219/221
Virtual IP 10.85.10.122/123 -- > 10.85.10.222/223
实验平台: redhat 4.7 + ORACLE 10G + raw +ASM
一. 停止oracle相关的所有进程, 包括数据库, asm, node application, crs本身.
1.1 查看当前系统上crs运行的状态
[root@raw1 bin]# pwd
/u01/app/oracle/product/crs/bin
[root@raw1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.raw.db application OFFLINE OFFLINE
ora.raw.dmm.cs application OFFLINE OFFLINE
ora....aw2.srv application OFFLINE OFFLINE
ora....w1.inst application OFFLINE OFFLINE
ora....w2.inst application OFFLINE OFFLINE
ora....SM1.asm application OFFLINE OFFLINE
ora....W1.lsnr application OFFLINE OFFLINE
ora.raw1.gsd application OFFLINE OFFLINE
ora.raw1.ons application OFFLINE OFFLINE
ora.raw1.vip application OFFLINE OFFLINE
ora....SM2.asm application OFFLINE OFFLINE
ora....W2.lsnr application OFFLINE OFFLINE
ora.raw2.gsd application OFFLINE OFFLINE
ora.raw2.ons application OFFLINE OFFLINE
ora.raw2.vip application OFFLINE OFFLINE
1.2 关闭数据库
[root@raw1 bin]# ./srvctl stop database -d raw
1.3 关闭asm实例
[root@raw1 bin]# ./srvctl stop asm -n raw1
[root@raw1 bin]# ./srvctl stop asm -n raw2
1.4 关闭其他应用程序
[root@raw1 bin]# ./srvctl stop nodeapps -n raw1
[root@raw1 bin]# ./srvctl stop nodeapps -n raw2
1.5 关闭crs后台进程, 在操作系统一级中止运行的crs后台进程, 必须在所有节点上运行.
[root@raw1 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@raw2 ~]# /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设置
2.1 修改 /etc/hosts 文件。 保持2个节点的一致
[root@raw1 bin]# vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost
10.85.10.219 raw1
10.85.10.221 raw2
192.168.1.219 raw1-priv
192.168.1.221 raw2-priv
10.85.10.222 raw1-vip
10.85.10.223 raw2-vip
2.2 在两个节点上分别修改eth0和eth1地址:
[root@raw1 etc]# more /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
IPADDR=10.85.10.219
NETMASK=255.255.255.0
ONBOOT=yes
GATEWAY=10.85.10.253
[root@raw2 ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=static
IPADDR=10.85.10.221
NETMASK=255.255.255.0
ONBOOT=yes
GATEWAY=10.85.10.253
[root@raw1 etc]# more /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
IPADDR=192.168.1.219
NETMASK=255.255.255.0
ONBOOT=yes
GATEWAY=192.168.1.1
[root@raw2 ~]# more /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
IPADDR=192.168.1.221
NETMASK=255.255.255.0
ONBOOT=yes
GATEWAY=192.168.1.1
2.3 在两个节点上分别重启网络服务,是修改的IP生效。
[root@raw1 ~]# service network restart
[root@raw2 ~]# service network restart
三. 启动crs, 设置oracle中ip地址相关的设置.
3.1 在两个节点启动crs, 并关闭随crs启动的应用程序
[root@raw1 ~]# /etc/init.d/init.crs start
Startup will be queued to init within 90 seconds.
[root@raw2 ~]# /etc/init.d/init.crs start
Startup will be queued to init within 90 seconds.
由于oracle所有应用设置为自动启动, 所以在crs启动时会试图启动所有的服务, 但是在对oracle相关的ip地址进行设置时需要crs处于运行状态. 但是数据库, asm和node application处于停止状态, 在一个节点执行以下命令:
[root@raw1 bin]# ./srvctl stop database -d raw
[root@raw1 bin]# ./srvctl stop asm -n raw1
[root@raw1 bin]# ./srvctl stop asm -n raw2
[root@raw1 bin]# ./srvctl stop nodeapps -n raw1
[root@raw1 bin]# ./srvctl stop nodeapps -n raw2
[root@raw1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.raw.db application OFFLINE OFFLINE
ora.raw.dmm.cs application OFFLINE OFFLINE
ora....aw2.srv application OFFLINE OFFLINE
ora....w1.inst application OFFLINE OFFLINE
ora....w2.inst application OFFLINE OFFLINE
ora....SM1.asm application OFFLINE OFFLINE
ora....W1.lsnr application OFFLINE OFFLINE
ora.raw1.gsd application OFFLINE OFFLINE
ora.raw1.ons application OFFLINE OFFLINE
ora.raw1.vip application OFFLINE OFFLINE
ora....SM2.asm application OFFLINE OFFLINE
ora....W2.lsnr application OFFLINE OFFLINE
ora.raw2.gsd application OFFLINE OFFLINE
ora.raw2.ons application OFFLINE OFFLINE
ora.raw2.vip application OFFLINE OFFLINE
3.2 使用oifcfg修改网卡设置, oifconfig可以用来设置和查看网卡使用的方式.
注: 如果修改的网段相同,可以不做这一步。
-- 查看当前配置:
[root@raw1 bin]# ./oifcfg getif -global
eth0 10.85.10.0 global public
eth1 192.168.1.0 global cluster_interconnect
-- 删除当前配置
[root@raw1 bin]# ./oifcfg delif -global eth0
[root@raw1 bin]# ./oifcfg delif -global eth1
[root@raw1 bin]# ./oifcfg getif
-- 重新添加
[root@raw1 bin]# ./oifcfg setif -global eth0/10.85.10.0:public
[root@raw1 bin]# ./oifcfg setif -global eth1/192.168.1.0:cluster_interconnect
[root@raw1 bin]# ./oifcfg getif
eth0 10.85.10.0 global public
eth1 192.168.1.0 global cluster_interconnect
[root@racnode2 bin]# ./oifcfg iflist
eth0 192.168.86.0
eth1 192.168.0.0
eth2 192.168.200.0
eth3 192.168.200.0
eth4 192.168.200.0
eth5 192.168.200.0
注意: 这里IP 地址最一个为0. 代表的是一个网段。 修改的时候要切记。 否在在启动OCR 时 会报如下错误:
[ CRSOCR][4054413904] OCR context init failure. Error: PROC-44: 网络地址和网络接口操作中出错 网络地址和网络接口操作错误 [7]
3.3 修改VIP
[root@raw1 bin]# ./srvctl modify nodeapps -n raw1 -A 10.85.10.222/255.255.255.0/eth0
[root@raw1 bin]# ./srvctl modify nodeapps -n raw2 -A 10.85.10.223/255.255.255.0/eth0
3.4 设置listener.ora和tnsnames.ora, 检查这些文件中是否有指定原来ip的地方, 修改为更改后的ip地址。
[root@raw1 bin]# vi /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
# listener.ora.raw1 Network Configuration File:
/u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora.raw1
# Generated by Oracle configuration tools.
LISTENER_RAW1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = raw1-vip)(PORT = 1521)(IP = FIRST))
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.85.10.219)(PORT = 1521)(IP = FIRST))
)
)
注意:如果你使用了ocfs,修改ocfs配置文件(/etc/ocfs/cluster.conf),验证修改后是否可用。
3.5 启动node applications, asm, 数据库
[root@raw1 bin]# ./srvctl start nodeapps -n raw1
[root@raw1 bin]# ./srvctl start nodeapps -n raw2
[root@raw1 bin]# ./srvctl start asm -n raw1
[root@raw1 bin]# ./srvctl start asm -n raw2
[root@raw1 bin]# ./srvctl start instance -d raw -i raw1
[root@raw1 bin]# ./srvctl start instance -d raw -i raw2
[root@raw1 bin]# ./crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.raw.db application ONLINE ONLINE raw2
ora.raw.dmm.cs application ONLINE ONLINE raw2
ora....aw2.srv application ONLINE ONLINE raw2
ora....w1.inst application ONLINE ONLINE raw1
ora....w2.inst application ONLINE ONLINE raw2
ora....SM1.asm application ONLINE ONLINE raw1
ora....W1.lsnr application ONLINE ONLINE raw1
ora.raw1.gsd application ONLINE ONLINE raw1
ora.raw1.ons application ONLINE ONLINE raw1
ora.raw1.vip application ONLINE ONLINE raw1
ora....SM2.asm application ONLINE ONLINE raw2
ora....W2.lsnr application ONLINE ONLINE raw2
ora.raw2.gsd application ONLINE ONLINE raw2
ora.raw2.ons application ONLINE ONLINE raw2
ora.raw2.vip application ONLINE ONLINE raw2
若启动出现问题,参考我的blog:
Oracle RAC 启动与关闭
http://blog.csdn.net/tianlesoftware/archive/2010/03/05/5349003.aspx
3.6 确认IP, 修改完成。
[root@raw1 bin]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:55:28:FD
inet addr:10.85.10.219 Bcast:10.85.10.255 Mask:255.255.255.0
... ...
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:55:28:FD
inet addr:10.85.10.222 Bcast:10.85.10.255 Mask:255.255.255.0
... ...
eth1 Link encap:Ethernet HWaddr 00:0C:29:55:28:07
inet addr:192.168.1.219 Bcast:192.168.1.255 Mask:255.255.255.0
... ...
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
[root@raw2 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:2E:28:EE
inet addr:10.85.10.221 Bcast:10.85.10.255 Mask:255.255.255.0
... ...
eth0:1 Link encap:Ethernet HWaddr 00:0C:29:2E:28:EE
inet addr:10.85.10.223 Bcast:10.85.10.255 Mask:255.255.255.0
... ...
eth1 Link encap:Ethernet HWaddr 00:0C:29:2E:28:F8
inet addr:192.168.1.221 Bcast:192.168.1.255 Mask:255.255.255.0
... ...
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
... ...