zt:[原创]更改rac的vip地址和集群互联地址

http://www.itpub.net/618614.html

更改rac的vip地址和集群互联地址
作者 blue_stone
E-mail: blue_stone#xinhuanet_com(#更换成@,_更换成'.')
Blog: http://bluestone.cublog.cn

今天准备打开我的debian下的oracle 10gR2来做一些java测试, 可是忘记了上次关机以来我的网络以及vmware都做了调整, 竟然无法直接访问. 就想把debian虚拟机使用的ip地址给改改. 主机名及修改前后的ip地址如下:

主机名 修改前的ip地址 修改后的ip地址 作用
rac1 192.168.0.181 192.168.1.181 rac1 eth0 native ip
rac2 192.168.0.182 192.168.1.182 rac2 eth0 native ip
rac1-vip 192.168.0.191 192.168.1.191 rac1 vip
rac2-vip 192.168.0.192 192.168.1.192 rac2 vip
rac1-priv 10.10.10.181 10.1.0.181 rac1 eth1 ip interconn
rac2-priv 10.10.10.182 10.1.0.182 rac2 eth1 ip interconn

思路如下, 停止所有oracle相关的进程, 然后修改操作系统的ip设置, 修改与oracle相关的ip地址的设定, 启动crs及相关服务.

具体操作步骤如下:

1 停止oracle相关的所有进程, 包括数据库, asm, node application, crs本身.

1.1 查看当前系统上crs运行的状态

oracle@rac2:/u01/app/oracle/product/10.2.0/crs/bin$ ./crs_stat
NAME=ora.orcl.db
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2

NAME=ora.orcl.orcl1.inst
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.orcl.orcl2.inst
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2

NAME=ora.rac1.ASM1.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.rac1.LISTENER_RAC1.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.rac1.gsd
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.rac1.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.rac1.vip
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.rac2.ASM2.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2

NAME=ora.rac2.LISTENER_RAC2.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2

NAME=ora.rac2.gsd
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2

NAME=ora.rac2.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2

NAME=ora.rac2.vip
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2

1.2 关闭数据库

oracle@rac2:/u01/app/oracle/product/10.2.0/crs/bin$ srvctl stop database -d orcl

1.3 关闭asm实例

oracle@rac2:/u01/app/oracle/product/10.2.0/crs/bin$ srvctl stop asm -n rac1
oracle@rac2:/u01/app/oracle/product/10.2.0/crs/bin$ srvctl stop asm -n rac2

1.4 关闭其他应用程序

rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl stop nodeapps -n rac1
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl stop nodeapps -n rac2

1.5 关闭crs后台进程, 这一操作会在操作系统一级中止运行的crs后台进程, 必须在所有节点上运行.

rac1:/u01/app/oracle/product/10.2.0/crs/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.

2 修改操作系统的ip设置

debian的网络配置文件为/etc/network/interfaces和/etc/hosts, 其他linux发行版及unix网络配置文件位置可能并不一样. 以节点rac1为例, 修改前/etc/network/interfaces文件内容为:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0 eth1
iface eth0 inet static
address 192.168.0.181
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.106.0.20

iface eth1 inet static
address 10.10.10.181
netmask 255.255.255.0
network 10.10.10.0
broadcast 10.10.10.255

修改后内容为:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0 eth1
iface eth0 inet static
address 192.168.1.181
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.106.0.20

iface eth1 inet static
address 10.1.0.181
netmask 255.255.255.0
network 10.1.0.0
broadcast 10.1.0.255

/etc/hosts文件内容为:

127.0.0.1 localhost.localdomain localhost
192.168.0.181 rac1
192.168.0.182 rac2

192.168.0.191 rac1-vip
192.168.0.192 rac2-vip

10.10.10.181 rac1-priv
10.10.10.182 rac2-priv

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

修改后:

127.0.0.1 localhost.localdomain localhost
192.168.1.181 rac1
192.168.1.182 rac2

192.168.1.191 rac1-vip
192.168.1.192 rac2-vip

10.1.0.181 rac1-priv
10.1.0.182 rac2-priv

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

集群中所有节点的hosts文件应该保持一致.

/etc/network/interfaces和/etc/hosts文件修改后可使用

/etc/init.d/networking restart

或者重启操作系统使设置生效.

3 启动crs, 设置oracle中ip地址相关的设置.

3.1 启动crs, 并关闭随crs启动的应用程序

rac1:/u01/app/oracle/product/10.2.0/db_1/network/admin# /etc/init.d/init.crs start
Startup will be queued to init within 90 seconds.

由于oracle所有应用设置为自动启动, 所以在crs启动时会试图启动所有的服务,
但是在对oracle相关的ip地址进行设置时需要crs处于运行状态而数据库, asm和node application处于停止状态,
所以需要我们参考1.2, 1.3, 1.4的内容关闭数据库, asm和node application.

3.2 使用oifcfg修改网卡设置, oifconfig可以被用来设置和查看网卡被oracle使用的方式.

rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg getif -global
eth0 192.168.0.0 global public
eth1 10.10.10.0 global cluster_interconnect
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg setif -global eth0/192.168.1.0ublic
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg iflist
eth0 192.168.1.0
eth0 192.168.0.0
eth1 10.1.0.0
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg delif -global eth0/192.168.0.0
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg iflist
eth0 192.168.1.0
eth1 10.1.0.0
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg getif -global
eth0 192.168.1.0 global public
eth1 10.10.10.0 global cluster_interconnect
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./lifcfg setif -global eth1:/10.1.0.0:cluster_interconnect
-bash: ./lifcfg: No such file or directory
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg setif -global eth1:/10.1.0.0:cluster_interconnect
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg getif -global
eth0 192.168.1.0 global public
eth1 10.10.10.0 global cluster_interconnect
eth1: 10.1.0.0 global cluster_interconnect
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg setif -global eth1/10.1.0.0:cluster_interconnect
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg getif -global
eth0 192.168.1.0 global public
eth1 10.10.10.0 global cluster_interconnect
eth1 10.1.0.0 global cluster_interconnect
eth1: 10.1.0.0 global cluster_interconnect
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg delif -global eth1:
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg delif -global eth1/10.10.10.0
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./oifcfg getif -global
eth0 192.168.1.0 global public
eth1 10.1.0.0 global cluster_interconnect

oifcfg iflist会显示当前使用的网卡及其子网设置, 而oifcfg getif -global 则会显示配置文件中的信息.

3.3 修改vip地址

rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl modify nodeapps -n rac1 -A 192.168.1.191/255.255.255.0/eth0
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl modify nodeapps -n rac2 -A 192.168.1.192/255.255.255.0/eth0

3.4 设置listener.ora和tnsnames.ora, 检查这些文件中是否有指定原来ip的地方, 修改为更改后的ip地址,
在rac1的配置文件中listener.ora包含了 192.168.0.181我修改成了192.168.1.181, rac2上的
listener.ora也做了相应的修改.

3.5 启动node applications, asm, 数据库

rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl start nodeapps -n rac1
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl start nodeapps -n rac2
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl start asm -n rac2
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl start asm -n rac1
rac2:/u01/app/oracle/product/10.2.0/crs/bin#
rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./srvctl start database -d orcl

3.6 来看看我们的成果:

rac2:/u01/app/oracle/product/10.2.0/crs/bin# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0C:29:0D:FE:0F
inet addr:192.168.1.182 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:142242 errors:0 dropped:0 overruns:0 frame:0
TX packets:140057 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:83167889 (79.3 MiB) TX bytes:87987399 (83.9 MiB)
Interrupt:19 Base address:0x1480

eth0:1 Link encap:Ethernet HWaddr 00:0C:29:0D:FE:0F
inet addr:192.168.1.192 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:19 Base address:0x1480

eth1 Link encap:Ethernet HWaddr 00:0C:29:0D:FE:19
inet addr:10.1.0.182 Bcast:10.1.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:29781 errors:0 dropped:0 overruns:0 frame:0
TX packets:26710 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:19667330 (18.7 MiB) TX bytes:11573375 (11.0 MiB)
Interrupt:16 Base address:0x1800

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:21796 errors:0 dropped:0 overruns:0 frame:0
TX packets:21796 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:6238339 (5.9 MiB) TX bytes:6238339 (5.9 MiB)

rac2:/u01/app/oracle/product/10.2.0/crs/bin# ./crs_stat
NAME=ora.orcl.db
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.orcl.orcl1.inst
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.orcl.orcl2.inst
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2

NAME=ora.rac1.ASM1.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.rac1.LISTENER_RAC1.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.rac1.gsd
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.rac1.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.rac1.vip
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.rac2.ASM2.asm
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2

NAME=ora.rac2.LISTENER_RAC2.lsnr
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2

NAME=ora.rac2.gsd
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2

NAME=ora.rac2.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2

NAME=ora.rac2.vip
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac2

rac2:/u01/app/oracle/product/10.2.0/crs/bin# su - oracle
oracle@rac2:~$ lsnrctl stat

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 23-AUG-2006 23:23:47

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER_RAC2
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 23-AUG-2006 22:24:44
Uptime 0 days 0 hr. 59 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener_rac2.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.192)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.182)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM2", status BLOCKED, has 1 handler(s) for this service...
Service "+ASM_XPT" has 1 instance(s).
Instance "+ASM2", status BLOCKED, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 2 instance(s).
Instance "orcl1", status READY, has 1 handler(s) for this service...
Instance "orcl2", status READY, has 2 handler(s) for this service...
Service "orclXDB" has 2 instance(s).
Instance "orcl1", status READY, has 1 handler(s) for this service...
Instance "orcl2", status READY, has 1 handler(s) for this service...
Service "orcl_XPT" has 2 instance(s).
Instance "orcl1", status READY, has 1 handler(s) for this service...
Instance "orcl2", status READY, has 2 handler(s) for this service...
The command completed successfully

以上操作大部分使用root进行, 实时上, 使用svrctl进行的操作可以使用root用户完成也可以使用oracle用户完成, 而修改vip则必须使用root用户完成使用crs_stat -ls可以查看各个资源的所有者, 属组, 以及相应的权限.

时间: 2024-10-06 01:48:19

zt:[原创]更改rac的vip地址和集群互联地址的相关文章

Oracle 11gR2 RAC Database使用emca配置集群dbconsole

下面的步骤详细的说明了在Oracle 11gR2 RAC Database环境下使用emca配置集群dbconsole遇到的部分问题及解决的方法. 1.数据库环境.Oracle Exadata Machine x4-2Oracle RAC Database 11.2.0.4.6 for Linux x86_64bit[root@dm01db01 ~]# uname -r2.6.39-400.126.1.el5uek 2.使用EMCA创建EM.[root@dm01db01 ~]# su - ora

【Oracle 集群】ORACLE DATABASE 11G RAC 知识图文详细教程之RAC 工作原理和相关组件(三)

RAC 工作原理和相关组件(三) RAC 工作原理和相关组件       OracleRAC 是多个单实例在配置意义上的扩展,实现由两个或者多个节点(实例)使用一个共同的共享数据库(例如,一个数据库同时安装多个实例并打开).在这种情况下,每一个单独的实例有它自己的 cpu 和物理内存,也有自己的 SGA 和后台进程.和传统的 oracle 实例相比,在系统全局区(SYSTEM CLOBAL AREA,SGA)与后台进程有着显著的不同.最大的不同之处在于多了一个GRD,GRD内存块主要是记录此ra

如何在服务器集群配置中相互接管IP地址

客户在二个不同的iSeries之间利用IASP实现相互备份,客户端通过Telnet连接到其中的主生产机或备机,如果一旦被连接的系统失败时,客户能否不需修改客户端会话参数(主机的IP地址),用同一个telnet会话无缝连接到另一系统上? 工作原理: 首先将SYSA 与 SYSB二个系统配置为集群环境,其中IASP1可以在二个系统中切换.虚拟IP为 19.19.19.19,这地址所属的网络地址范围不属于当前网络. 这虚拟IP地址是包含IASP1的集群资源组(cluster resource grou

ORA-01291: missing logfile Oracle RAC 集群环境下日志文件结构

在Oracle11g RAC环境中,对集群中的日志的定期检查是必不可少的.通过查看集群日志,可以早期定位集群环境中出现的问题, 以便将问题消灭在萌芽状态. 简单介绍一下有关Oracle集群环境中日志的结构,方便快速查找所需的日志文件. 1.Oracle集群日志藏匿之处 Oracle集群涉及的日志主要位于"$ORA_CRS_HOME/log"和"$ORACLE_HOME/log"目录中. SQL> SELECT  capture_name,queue_name,

Oracle 集群】ORACLE DATABASE 11G RAC 知识图文详细教程之ORACLE集群概念和原理(二)

ORACLE集群概念和原理(二) Oracle集群概念和原理 Oracle的三种高可用集群方案 1 RAC(Real Application Clusters)                         多个Oracle服务器组成一个共享的Cache,而这些Oracle服务器共享一个基于网络的存储.这个系统可以容忍单机/或是多机失败.不过系统内部的多个节点需要高速网络互连,基本上也就是要全部东西放在在一个机房内,或者说一个数据中心内.如果机房出故障,比如网络不通,那就坏了.所以仅仅用RAC

RAC集群简介(原创)

什么是集群  集群(Cluster)是由两台或多台节点机(服务器)构成的一种松散耦合的计算节点集合,为用户提供网络服务或应 用程序(包括数据库.Web服务和文件服务等)的单一客户视图.集群系统一般通过两台或多台节点服务器系统通过相应的硬件及软件互连,每个群集节点都是运 行其自己进程的独立服务器.这些进程可以彼此通信,对网络客户机来说就像是形成了一个单一系统,协同起来向用户提供应用程序.系统资源和数据.除了作为单 一系统提供服务,集群系统还具有恢复服务器级故障的能力.集群系统还可通过在集群中继续增

zt: 在linux上单机模拟Oracle 10g RAC集群(OCFS+ASM)

http://www.itpub.net/579479.html 本想做个安装记录,把遇到的错误和解决办法写下来,以备以后操作时参考,但在写的过程中阴错阳差地对付着把系统装上了,所以就当个安装说明吧,不过其中还有个错误(在下面有记录),感觉应该对使用有影响,所以以后还要想办法修正.这个就当个初稿吧. 一.简介 熟悉 Oracle 真正应用集群 (RAC) 10g 技术的最有效方法之一是访问一个实际的 Oracle RAC 10g 集群.没有什么方法比直接体验它们能够更好地理解其好处的了 - 包括

11GR2 RAC modify vip,public 修改VIP步骤

11GR2 RAC modify vip,public 修改VIP步骤    11GR2 RAC modify vip,public  ip,private ip,scan vip  实施步骤        第1页共11页   目录    1  修改目的...........................................................................................................................

如何更改VNX Storage Processsor和Control Station的管理地址

准备工作 a) 列出VNX Storage Processsor和Control Station的新的IP地址清单.   b) 用串口线连接CS0,并通过putty登陆.注:从Control Station的背面看,串口位于最右边.     c) 登陆Putty,配置参数如下:   bits per second: 19200 data bits: 8 parity: None stop bit: 1 flow control: None Telnet terminal ID: ANSI   d