首页 > 代码库 > 10G RAC手动注册监听服务

10G RAC手动注册监听服务

下面测试来至一次增加与删除实例实验,在10G RAC中知道监听是通过netca来管理的,跟11G的机制不一样。

当增加节点的时候,需要手动执行netca来注册监听服务。其实我们也可以通过crs_profile工具来手动注册监听服务。

 

欢迎大家加入ORACLE超级群:17115662 免费解决各种ORACLE问题

 

数据库版本信息

[oracle@www.htz.pw oracle] $sqlplus / as sysdba

 

SQL*Plus: Release 10.2.0.4.0 - Production on Sun May 11 17:06:26 2014

 

Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

 

 

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

 

SQL> select * from v$version;

 

BANNER

----------------------------------------------------------------

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod

PL/SQL Release 10.2.0.4.0 - Production

CORE    10.2.0.4.0      Production

TNS for Solaris: Version 10.2.0.4.0 - Production

NLSRTL Version 10.2.0.4.0 - Production

1,配置tnsnames.oralistener.ora文件

如下:

[root@www.htz.pw admin] $ cat listener.ora

# listener.ora.sol1 Network Configuration File: /oracle/app/oracle/product/10.2.0/db_1/network/admin/listener.ora.sol1

# Generated by Oracle configuration tools.

 

LISTENER_SOL1 =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.111.48)(PORT = 1521)(IP = FIRST))

      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.111.46)(PORT = 1521)(IP = FIRST))

    )

  )

#这里建议使用IP地址

SID_LIST_LISTENER_SOL1 =

  (SID_LIST =

    (SID_DESC =

      (SID_NAME = PLSExtProc)

      (ORACLE_HOME = /oracle/app/oracle/product/10.2.0/db_1)

      (PROGRAM = extproc)

    )

  )

 

 

 

[root@www.htz.pw app] $cd $ORACLE_HOME/network/admin

[root@www.htz.pw admin] $ cat tnsnames.ora

# tnsnames.ora.sol1 Network Configuration File: /oracle/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora.sol1

# Generated by Oracle configuration tools.

 

LISTENERS_SOL10G =

  (ADDRESS_LIST =

    (ADDRESS = (PROTOCOL = TCP)(HOST = sol1-vip)(PORT = 1521))

    (ADDRESS = (PROTOCOL = TCP)(HOST = sol2-vip)(PORT = 1521))

  )

#这里建议使用IP地址,在10G中配置REMOTE_LISTENER的时候,默认会用到这里的东西

SOL10G2 =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = sol2-vip)(PORT = 1521))

    (CONNECT_DATA =http://www.mamicode.com/

      (SERVER = DEDICATED)

      (SERVICE_NAME = sol10g)

      (INSTANCE_NAME = sol10g2)

    )

  )

 

SOL10G1 =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = sol1-vip)(PORT = 1521))

    (CONNECT_DATA =http://www.mamicode.com/

      (SERVER = DEDICATED)

      (SERVICE_NAME = sol10g)

      (INSTANCE_NAME = sol10g1)

    )

  )

 

SOL10G =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = sol1-vip)(PORT = 1521))

    (ADDRESS = (PROTOCOL = TCP)(HOST = sol2-vip)(PORT = 1521))

    (LOAD_BALANCE = yes)

    (CONNECT_DATA =http://www.mamicode.com/

      (SERVER = DEDICATED)

      (SERVICE_NAME = sol10g)

    )

  )

2crs_register注册监听服务

注意监听服务有两种方法,1,利用现在的监听的配置信息。2,使用crs_profile来创建

2.1 利用现有的监听配置信息

[oracle@www.htz.pw oracle] $ crs_stat -p ora.sol2.LISTENER_SOL2.lsnr >/tmp/listener.txt

这里导出正常节点的监听配置信息

 

[oracle@www.htz.pw oracle] $ cat /tmp/listener.txt

NAME=ora.sol1.LISTENER_SOL1.lsnr

#这里需要注意的LISTENER_SOL1这个名字需要跟listener.ora中的监听名一致

TYPE=application

ACTION_SCRIPT=/oracle/app/oracle/product/10.2.0/db_1/bin/racgwrap

ACTIVE_PLACEMENT=0

AUTO_START=1

CHECK_INTERVAL=600

DESCRIPTION=CRS application for listener on node

FAILOVER_DELAY=0

FAILURE_INTERVAL=0

FAILURE_THRESHOLD=0

HOSTING_MEMBERS=sol1

OPTIONAL_RESOURCES=

PLACEMENT=restricted

REQUIRED_RESOURCES=ora.sol1.vip

RESTART_ATTEMPTS=5

SCRIPT_TIMEOUT=600

START_TIMEOUT=0

STOP_TIMEOUT=0

UPTIME_THRESHOLD=7d

USR_ORA_ALERT_NAME=

USR_ORA_CHECK_TIMEOUT=0

USR_ORA_CONNECT_STR=/ as sysdba

USR_ORA_DEBUG=0

USR_ORA_DISCONNECT=false

USR_ORA_FLAGS=

USR_ORA_IF=

USR_ORA_INST_NOT_SHUTDOWN=

USR_ORA_LANG=

USR_ORA_NETMASK=

USR_ORA_OPEN_MODE=

USR_ORA_OPI=false

USR_ORA_PFILE=

USR_ORA_PRECONNECT=none

USR_ORA_SRV=

USR_ORA_START_TIMEOUT=0

USR_ORA_STOP_MODE=immediate

USR_ORA_STOP_TIMEOUT=0

USR_ORA_VIP=

一共就3个地址需要修改

[oracle@www.htz.pw oracle]$ mv /tmp/listener.txt $ORA_CRS_HOME/crs/public/ora.sol1.LISTENER_SOL1.lsnr.cap

[oracle@www.htz.pw oracle]$ crs_register ora.sol1.LISTENER_SOL1.lsnr                  

[oracle@www.htz.pw oracle]$ crs_start ora.sol1.LISTENER_SOL1.lsnr  

Attempting to start `ora.sol1.LISTENER_SOL1.lsnr` on member `sol1`

Start of `ora.sol1.LISTENER_SOL1.lsnr` on member `sol1` succeeded.

监听能正常启动

2.2 使用crs_profiler来手动创建监听

不到万不得以,不建议使用下面的方法

[oracle@www.htz.pw oracle]$ crs_profile -create ora.sol1.LISTENER_SOL1.lsnr -t application -a /oracle/app/oracle/product/10.2.0/db_1/bin/racgwrap  -d "CRS application for listener on node" -h sol1 -r ora.sol1.vip -p restricted -o as=1,ci=600,st=600,ra=5

 

[oracle@www.htz.pw oracle]$ cat ora.sol1.LISTENER_SOL1.lsnr.cap

NAME=ora.sol1.LISTENER_SOL1.lsnr

TYPE=application

ACTION_SCRIPT=/oracle/app/oracle/product/10.2.0/db_1/bin/racgwrap

ACTIVE_PLACEMENT=0

AUTO_START=1

CHECK_INTERVAL=600

DESCRIPTION=CRS application for listener on node

FAILOVER_DELAY=0

FAILURE_INTERVAL=0

FAILURE_THRESHOLD=0

HOSTING_MEMBERS=sol1

OPTIONAL_RESOURCES=

PLACEMENT=restricted

REQUIRED_RESOURCES=ora.sol1.vip

RESTART_ATTEMPTS=5

SCRIPT_TIMEOUT=600

START_TIMEOUT=0

STOP_TIMEOUT=0

UPTIME_THRESHOLD=7d

USR_ORA_ALERT_NAME=

USR_ORA_CHECK_TIMEOUT=0

USR_ORA_CONNECT_STR=/ as sysdba

USR_ORA_DEBUG=0

USR_ORA_DISCONNECT=false

USR_ORA_FLAGS=

USR_ORA_IF=

USR_ORA_INST_NOT_SHUTDOWN=

USR_ORA_LANG=

USR_ORA_NETMASK=

USR_ORA_OPEN_MODE=

USR_ORA_OPI=false

USR_ORA_PFILE=

USR_ORA_PRECONNECT=none

USR_ORA_SRV=

USR_ORA_START_TIMEOUT=0

USR_ORA_STOP_MODE=immediate

USR_ORA_STOP_TIMEOUT=0

USR_ORA_VIP=

 

 

[oracle@www.htz.pw oracle]$ crs_register ora.sol1.LISTENER_SOL1.lsnr                       

[oracle@www.htz.pw oracle]$ crs_start ora.sol1.LISTENER_SOL1.lsnr                          

Attempting to start `ora.sol1.LISTENER_SOL1.lsnr` on member `sol1`

Start of `ora.sol1.LISTENER_SOL1.lsnr` on member `sol1` succeeded   

 

其实如果是VIP资源的时候,我们需要注意了,因为VIP资料的属组是root

[oracle@www.htz.pw oracle]$ crs_stat -ls                                                    

Name           Owner          Primary PrivGrp          Permission 

----------------------------------------------------------------- 

ora....L1.lsnr oracle         oinstall                 rwxrwxr--  

ora.sol1.gsd   oracle         oinstall                 rwxr-xr--  

ora.sol1.ons   oracle         oinstall                 rwxr-xr--  

ora.sol1.vip   root           oinstall                 rwxr-xr--  

ora.sol10g.db  oracle         oinstall                 rwxrwxr--  

ora....g2.inst oracle         oinstall                 rwxrwxr--  

ora....SM2.asm oracle         oinstall                 rwxrwxr--  

ora....L2.lsnr oracle         oinstall                 rwxrwxr--  

ora.sol2.gsd   oracle         oinstall                 rwxr-xr--  

ora.sol2.ons   oracle         oinstall                 rwxr-xr--  

ora.sol2.vip   root           oinstall                 rwxr-xr