sitemap

RSS地图

收藏本站

设为首页

Oracle研究中心

当前位置:Oracle研究中心 > 运维DBA >

【学习笔记】Oracle 10G RAC环境更改公网IP以及VIP的详细步骤

时间:2016-12-01 22:16   来源:Oracle研究中心   作者:网络   点击:

天萃荷净 Oracle研究中心学习笔记:分享一篇关于Oracle 10G RAC环境IP资源管理文章,该文章详细介绍了如何更改10G RAC的公网IP和VIP的方法步骤。

本站文章除注明转载外,均为本站原创: 转载自love wife & love life —Roger 的Oracle技术博客
本文链接地址: step by step change public-ip and vip

如下是更改10g RAC 公网IP以及VIP的一个简单步骤:

1.  Stop all Crs resources
[oracle@hsdb1 ~]$ crs_stop -all

Attempting to stop `ora.hsdb1.gsd` on member `hsdb1`
Attempting to stop `ora.hsdb1.ons` on member `hsdb1`
Attempting to stop `ora.hskj.db` on member `hsdb1`
Attempting to stop `ora.hsdb2.gsd` on member `hsdb2`
Attempting to stop `ora.hskj.hskj_db.hskj2.srv` on member `hsdb2`
Stop of `ora.hsdb2.gsd` on member `hsdb2` succeeded.
Attempting to stop `ora.hsdb2.ons` on member `hsdb2`
Attempting to stop `ora.hskj.hskj_db.cs` on member `hsdb2`
Stop of `ora.hsdb1.gsd` on member `hsdb1` succeeded.
Stop of `ora.hskj.hskj_db.hskj2.srv` on member `hsdb2` succeeded.
Stop of `ora.hsdb1.ons` on member `hsdb1` succeeded.
Stop of `ora.hsdb2.ons` on member `hsdb2` succeeded.
Stop of `ora.hskj.hskj_db.cs` on member `hsdb2` succeeded.
Stop of `ora.hskj.db` on member `hsdb1Oracleoracleplus.net` succeeded.
`ora.hskj.hskj1.inst` is already OFFLINE.
`ora.hskj.hskj2.inst` is already OFFLINE.
Attempting to stop `ora.hsdb1.ASM1.asm` on member `hsdb1`
Target set to OFFLINE for `ora.hsdb1.LISTENER_HSDB1.lsnr`
Target set to OFFLINE for `ora.hsdb2.LISTENER_HSDB2.lsnr`
Attempting to stop `ora.hsdb2.ASM2.asm` on member `hsdb2`
Attempting to stop `ora.hsdb1.vip` on member `hsdb1`
Attempting to stop `ora.hsdb2.vip` on member `hsdb2`
Stop of `ora.hsdb1.vip` on member `hsdb1` succeeded.
Stop of `ora.hsdb2.vip` on member `hsdb2` succeeded.
Stop of `ora.hsdb2.ASM2.asm` on member `hsdb2` succeeded.
Stop of `ora.hsdb1.ASM1.asm` on member `hsdb1` succeeded.
CRS-0216: Could not stop resource 'ora.hskj.hskj1.inst'.

CRS-0216: Could not stop resource 'ora.hskj.hskj2.inst'.

当然我这里其实并不是标准的操作步骤,根据官方文档,其实应该如下操作:
srvctl stop asm -n asm1/asm2
srvctl stop instance -d hsdb -i hsdb1/hsdb2
srvctl stop nodeapps -n hsdb1/hsdb2

2.  Modify /etc/hosts

这里修改以后为如下:
[oracle@hsdb1 admin]$ cat /etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.

127.0.0.1        localhost.localdomain localhost
::1              localhost6.localdomain6 localhost6

#### for oracle rac

192.168.5.220    hsdb1
192.168.5.222    hsdb1-vip
10.10.10.1       hsdb1-priv

192.168.5.221    hsdb2
192.168.5.223    hsdb2-vip
10.10.10.2       hsdb2-priv

(注:RAC cluster中所有节点都需要进行修改。)

3. Change $ORACLE_HOME/network/admin/listener.ora

我这里修改以后为如下:
[oracle@hsdb1 admin]$ cat listener.ora

# listener.ora.hsdb1 Network Configuration File: /oracle/product/10.2/db/network/admin/listener.ora.hsdb1
# Generated by Oracle configuration tools.

SID_LIST_LISTENER_HSDB1 =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /oracle/product/10.2/db)
      (PROGRAM = extproc)
    )
  )

LISTENER_HSDB1 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.5.222)(PORT = 1521)(IP = FIRST))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.5.220)(PORT = 1521)(IP = FIRST))
    )
  )


#TRACE_LEVEL_LISTENER = 16  
#TRACE_FILE_LISTENER = /oracle/product/10.2/db/network/log/trace.log 
#TRACE_DIRECTORY_LISTENER = /oracle/product/10.2/db/network/log 
#TRACE_TIMESTAMP_LISTENER = ON  
#TRACE_FILELEN_LISTENER = 204800
#TRACE_FILENO_LISTENER = 10

#----ADDED BY TNSLSNR 18-DEC-2011 15:37:21---
SAVE_CONFIG_ON_STOP_LISTENER_HSDB1 = ON
INBOUND_CONNECT_TIMEOUT_LISTENER_HSDB1 = 0
#--------------------------------------------

(注:如果这里host你用的name,那么不必进行修改。)

4. Delete Public eth0 (在其中一个node操作即可)

[root@localhost bin]# ./oifcfg getif

eth0  192.168.1.0  global  public
eth1  10.10.10.0   global  cluster_interconnect

[root@localhost bin]# ./oifcfg delif -global eth0

[root@localhost bin]# ./oifcfg getif

eth1  10.10.10.0   global  cluster_interconnect

5. Add new public eth0

[root@localhost bin]# ./oifcfg setif -global eth0/192.168.5.0:public

[root@localhost bin]# ./oifcfg getif

eth0  192.168.5.0  global  public    <== 新的网段
eth1  10.10.10.0   global  cluster_interconnect


(注:因为vip地址必须跟public ip处于同一网段,故公网IP网段更改以后,必须更改vip地址或网段。)

6. Change vip

++++++ Node 1 ++++++

[root@hsdb1 crs]# cd bin

[root@hsdb1 bin]# ./srvctl modify nodeapps -n hsdb1 -A 192.168.5.222/255.255.255.0/eth0

++++++ Node 2 ++++++

[root@hsdb2 bin]# ./srvctl modify nodeapps -n hsdb2 -A 192.168.5.223/255.255.255.0/eth0

7. Start cluster all resource

[oracle@hsdb1 admin]$ crs_start -all

Attempting to start `ora.hsdb1.ASM1.asm` on member `hsdb1`
Attempting to start `ora.hsdb2.vip` on member `hsdb2`
Attempting to start `ora.hsdb1.vip` on member `hsdb1`
Attempting to start `ora.hsdb2.ASM2.asm` on member `hsdb2`
Start of `ora.hsdb2.vip` on member `hsdb2` succeeded.
Attempting to start `ora.hsdb2.LISTENER_HSDB2.lsnr` on member `hsdb2`
Start of `ora.hsdb2.LISTENER_HSDB2.lsnr` on member `hsdb2` succeeded.
Start of `ora.hsdb1.ASM1.asm` on member `hsdb1` succeeded.
Start of `ora.hsdb2.ASM2.asm` on member `hsdb2` succeeded.
Attempting to start `ora.hskj.hskj1.inst` on member `hsdb1`
Attempting to start `ora.hskj.hskj2.inst` on member `hsdb2`
Start of `ora.hsdb1.vip` on member `hsdb1` failed.
Attempting to start `ora.hsdb1.vip` on member `hsdb2`
Start of `ora.hsdb1.vip` on member `hsdb2` succeeded.
hsdb1 : CRS-1018: Resource ora.hsdb1.vip (application) is already running on hsdb2
hsdb2 : CRS-1019: Resource ora.hsdb1.LISTENER_HSDB1.lsnr (application) cannot run on hsdb2

Start of `ora.hskj.hskj2.inst` on member `hsdb2` succeeded.
Start of `ora.hskj.hskj1.inst` on member `hsdb1` succeeded.
CRS-1002: Resource 'ora.hsdb1.ons' is already running on member 'hsdb1'

CRS-1002: Resource 'ora.hsdb2.ons' is already running on member 'hsdb2'

CRS-1002: Resource 'ora.hskj.db' is already running on member 'hsdb1'

Attempting to start `ora.hsdb1.gsd` on member `hsdb1`
Attempting to start `ora.hskj.hskj_db.cs` on member `hsdb2`
Attempting to start `ora.hsdb2.gsd` on member `hsdb2`
Attempting to start `ora.hskj.hskj_db.hskj1.srv` on member `hsdb1`
Attempting to start `ora.hskj.hskj_db.hskj2.srv` on member `hsdb2`
Start of `ora.hskj.hskj_db.cs` on member `hsdb2` succeeded.
Start of `ora.hskj.hskj_db.hskj2.srv` on member `hsdb2` succeeded.
Start of `ora.hsdb2.gsd` on member `hsdb2` succeeded.
Start of `ora.hsdb1.gsd` on member `hsdb1` succeeded.
Start of `ora.hskj.hskj_db.hskj1.srv` on member `hsdb1` succeeded.
CRS-0223: Resource 'ora.hsdb1.LISTENER_HSDB1.lsnr' has placement error.

CRS-0223: Resource 'ora.hsdb1.ons' has placement error.

CRS-0223: Resource 'ora.hsdb2.ons' has placement error.

CRS-0223: Resource 'ora.hskj.db' has placement error.

[oracle@hsdb1 admin]$ crs_stat -t

Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    hsdb1      
ora....B1.lsnr application    OFFLINE   OFFLINE              
ora.hsdb1.gsd  application    ONLINE    ONLINE    hsdb1      
ora.hsdb1.ons  application    ONLINE    ONLINE    hsdb1      
ora.hsdb1.vip  application    ONLINE    ONLINE    hsdb1      
ora....SM2.asm application    ONLINE    ONLINE    hsdb2      
ora....B2.lsnr application    ONLINE    ONLINE    hsdb2      
ora.hsdb2.gsd  application    ONLINE    ONLINE    hsdb2      
ora.hsdb2.ons  application    ONLINE    ONLINE    hsdb2      
ora.hsdb2.vip  application    ONLINE    ONLINE    hsdb2      
ora.hskj.db    application    ONLINE    ONLINE    hsdb1      
ora....j1.inst application    ONLINE    ONLINE    hsdb1      
ora....j2.inst application    ONLINE    ONLINE    hsdb2      
ora....j_db.cs application    ONLINE    ONLINE    hsdb2      
ora....kj1.srv application    ONLINE    ONLINE    hsdb1      
ora....kj2.srv application    ONLINE    ONLINE    hsdb2      

[oracle@hsdb1 admin]$ crs_stat -p | grep lsnr

NAME=ora.hsdb1.LISTENER_HSDB1.lsnr
NAME=ora.hsdb2.LISTENER_HSDB2.lsnr

[oracle@hsdb1 admin]$ crs_start ora.hsdb1.LISTENER_HSDB1.lsnr

Attempting to start `ora.hsdb1.LISTENER_HSDB1.lsnr` on member `hsdb1`
Start of `ora.hsdb1.LISTENER_HSDB1.lsnr` on member `hsdb1` succeeded.

[oracle@hsdb1 admin]$ crs_stat -t

Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    hsdb1      
ora....B1.lsnr application    ONLINE    ONLINE    hsdb1      
ora.hsdb1.gsd  application    ONLINE    ONLINE    hsdb1      
ora.hsdb1.ons  application    ONLINE    ONLINE    hsdb1      
ora.hsdb1.vip  application    ONLINE    ONLINE    hsdb1      
ora....SM2.asm application    ONLINE    ONLINE    hsdb2      
ora....B2.lsnr application    ONLINE    ONLINE    hsdb2      
ora.hsdb2.gsd  application    ONLINE    ONLINE    hsdb2      
ora.hsdb2.ons  application    ONLINE    ONLINE    hsdb2      
ora.hsdb2.vip  application    ONLINE    ONLINE    hsdb2      
ora.hskj.db    application    ONLINE    ONLINE    hsdb1      
ora....j1.inst application    ONLINE    ONLINE    hsdb1      
ora....j2.inst application    ONLINE    ONLINE    hsdb2      
ora....j_db.cs application    ONLINE    ONLINE    hsdb2      
ora....kj1.srv application    ONLINE    ONLINE    hsdb1      
ora....kj2.srv application    ONLINE    ONLINE    hsdb2
8. Change local_listener
++++++ Node 1 ++++++

SQL> SHOW parameter listener

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
local_listener                       string
(ADDRESS = (PROTOCOL = TCP)(HO
ST = 192.168.1.222)(PORT = 152
1))

remote_listener                      string
LISTENERS_HSKJ


SQL> ALTER system
  2    SET local_listener = '(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.5.222)(PORT = 1521))'
  3        scope = BOTH
  4        sid = 'hskj1';

System altered.

SQL> SHOW parameter listener

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
local_listener                       string
(ADDRESS = (PROTOCOL = TCP)(HO
ST = 192.168.5.222)(PORT = 152
1))
remote_listener                      string
LISTENERS_HSKJ


++++++ Node 2 ++++++

SQL> ALTER system
  2    SET local_listener = '(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.5.223)(PORT = 1521))'
  3        scope = BOTH
  4          sid = 'hskj2';

System altered.

SQL> SHOW parameter instance_name

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
instance_name                        string                 hskj2

如上是一个简约步骤,没有任何难度,网上有人说最后还需重新配置ssh等效性,其实是不需要的,如下检测:

[oracle@hsdb1 ~]$ ssh hsdb2

Warning: Permanently added the RSA host key for IP address '192.168.5.221' to the list of known hosts.
Last login: Sat Feb 25 11:44:33 2012 from mail.atlantic.ro

[oracle@hsdb2 ~]$ ssh hsdb1

Warning: Permanently added the RSA host key for IP address '192.168.5.220' to the list of known hosts.
Last login: Sun Mar  4 17:12:51 2012 from 86.126.70.106

--------------------------------------ORACLE-DBA----------------------------------------

最权威、专业的Oracle案例资源汇总之【学习笔记】Oracle 10G RAC环境更改公网IP以及VIP的详细步骤

本文由大师惜分飞原创分享,网址:http://www.oracleplus.net/arch/1352.html

Oracle研究中心

关键词:

如何更改Oracle RAC公网IP

更改Oracle RAC VIP的详细步骤