【DATAGUARD】DATAGUARD 与 静态监听

在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>
上一篇:Android联网方式判断详解


下一篇:升级xenserver后存储报错:Error in Metadata volume operation for SR的处理方法