ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 【DATAGUARD】DATAGUARD 与 静态监听

【DATAGUARD】DATAGUARD 与 静态监听

原创 Linux操作系统 作者:杨奇龙 时间:2011-09-09 23:04:30 0 删除 编辑
在Oracle DATAGUARD实验中必须要用到静态监听,否则很严重(例子前面创建dg的过程中有遇到)
静态监听指实例启动时读取listener.ora配置文件,将实例和服务注册到监听程序。无论何时启动一个数据库,默认都有两条信息注册到监听器中:实例和服务
SID_LIST_LISTENER =
(SID_LIST =
  (SID_DESC =
    (GLOBAL_DBNAME = Oranet)
    (SID_NAME = yangdb)
  )
)
LISTENER =
  (DESCRIPTION =
    (
      ADDRESS = (HOST = 172.18.85.21)(PROTOCOL = TCP)(PORT = 1521)
    )
  )
  
SID_LIST_LISTENER中:
GLOBAL_DBNAME表示向外提供的服务名,
SID_NAME是提供注册的实例
在tnsnames.ora文件中的CONNECT_DATA部分,可分别选择SERVICE_NAME=Oranet或SID=yangdb为客户端提供连接。
动态注册不需要显示的配置listener.ora文件,实例启动的时候,PMON进程根据instance_name,service_name参数将实例和服务动态注册到listerer中。如果没有设定instance_name,将使用db_name初始化参数值。如果没有设定service_names,将拼接db_name和db_domain参数值来注册监听。
在DATAGUARD架构中,我们需要将备库启动到mount状态,并应用主库的redo日志文件。因此,主库和备库要能相互监听到对方。在动态监听的情况下,如果实例没有启动到open状态,就无法通过网络将服务注册到数据库,而只有静态监听可以完成这个任务。让实例启动时读取listener.ora配置文件,将实例和服务注册到监听程序。

LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=rac3)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                08-SEP-2011 11:42:07
Uptime                    0 days 0 hr. 14 min. 1 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/11.2.0/yangdb/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/rac3/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac3)(PORT=1521)))
Services Summary...
Service "yangdb" has 1 instance(s).
  Instance "yangdb", status UNKNOWN, has 1 handler(s) for this service...
Service "rac" has 1 instance(s).
  Instance "yangdb", status BLOCKED, has 1 handler(s) for this service...
The command completed successfully

如上面显示的blocked 状态!即阻塞状态,不能对外提供服务!
下面显示的是我配置的静态监听内容以及TNS文件内容,为listener.ora添加静态监听:
oracle@rac3:/opt/oracle/11.2.0/yangdb/network/admin>cat tnsnames.ora 
# tnsnames.ora Network Configuration File: /opt/oracle/11.2.0/yangdb/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
yangdb =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.250.7.241)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = yangdb)
    )
  )
rac =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.250.7.200)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = rac)
    )
  )
oracle@rac3:/opt/oracle/11.2.0/yangdb/network/admin>cat listener.ora 
# listener.ora Network Configuration File: /opt/oracle/11.2.0/yangdb/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
 (SID_LIST =
  (SID_DESC =
   (SID_NAME = PLSExtProc)
    (ORACLE_HOME = /opt/oracle/11.2.0/yangdb)
    (PROGRAM = extproc)
  )
 (SID_DESC =
  (GLOBAL_DBNAME = yangdb)
    (ORACLE_HOME = /opt/oracle/11.2.0/yangdb)
  (SID_NAME = yangdb)
 )
)

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rac3)(PORT = 1521))
    )
  )
ADR_BASE_LISTENER = /opt/oracle
oracle@rac3:/opt/oracle/11.2.0/yangdb/network/admin>lsnrctl reload
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 09-SEP-2011 22:44:24
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
The command completed successfully

oracle@rac3:/opt/oracle/11.2.0/yangdb/network/admin>lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 09-SEP-2011 22:44:33

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                08-SEP-2011 13:18:24
Uptime                    1 days 9 hr. 26 min. 9 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/11.2.0/yangdb/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/rac3/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=rac3)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "yangdb" has 2 instance(s).
  Instance "yangdb", status UNKNOWN, has 1 handler(s) for this service...
  Instance "yangdb", status READY, has 1 handler(s) for this service...
The command completed successfully
oracle@rac3:/opt/oracle/11.2.0/yangdb/network/admin>


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22664653/viewspace-707062/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
MySQL DBA NoSQL DEVOPS

注册时间:2009-10-07

  • 博文量
    1026
  • 访问量
    7843379