天天看點

listener.ora靜态注冊和動态注冊

listener.ora靜态注冊和動态注冊

參考oracle聯機叢書中   Net Services Reference的第7章 Listener Parameters (listener.ora)   oracle的Database services有2種注冊方式,靜态和動态。   Dynamic   service registration, a feature of Oracle9i and Oracle8, eliminates the need for static configuration of supported services. However, static service configuration is required if you plan to use Oracle Enterprise Manager. 動态服務注冊,是9i和8的特性,消除了為了提供服務而需要原來靜态配置的需求。然而, 如果你打算使用oem,那麼對于9i和8還是需要進行靜态服務注冊。( 10G之後已經不需要了,我嘗試将listener.ora完全清空。重新開機lsnrctl和emctl後,oem仍能夠正常使用)   For later database releases, the listener uses the dynamic service information about the database and instance it has received through service registration   before using statically configured information  in the  

listener.ora

 file. Therefore, the  

SID_LIST

 is not required, unless Oracle Enterprise Manager is used to monitor an Oracle9i or Oracle8 database.   如果使用動态注冊方式。他是通過PMON程序進行的,一般在啟動資料庫後PMON程序會一分鐘執行一次,檢測到沒有注冊的服務會進行注冊。如果等不了一分鐘,也可以使用 alter system register;指令進行手動注冊。  

Process Monitor Process (PMON)

The   process monitor (PMON)  performs process recovery when a user process fails. PMON is responsible for cleaning up the database buffer cache and freeing resources that the user process was using. For example, it resets the status of the active transaction table, releases locks, and removes the process ID from the list of active processes. PMON periodically checks the status of dispatcher and server processes, and restarts any that have stopped running (but not any that Oracle has terminated intentionally).   PMON also registers information about the instance and dispatcher processes with the network listener. (PMON程序負責網絡監聽資訊的注冊) Like SMON, PMON checks regularly to see whether it is needed and can be called if another process detects the need for it.     SQL> show parameter service NAME                                  TYPE

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

VALUE

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

service_names                         string

orcl.oracle.com

[[email protected] admin]$ sqlplus   scott/[email protected]:1521/orcl.oracle.com

    [[email protected] admin]$   cat listener.ora

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

# Generated by Oracle configuration tools. SID_LIST_LISTENER  =                                             #靜态注冊

   (SID_LIST =

     (SID_DESC =

       (SID_NAME = PLSExtProc)

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

       (PROGRAM = extproc)

     )

     (SID_DESC =

       (GLOBAL_DBNAME = orcl.oracle.com)

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

       (SID_NAME = orcl)

     )

     (SID_DESC =

       (GLOBAL_DBNAME = ocp)

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

       (SID_NAME = ocp)

     )

   ) LISTENER  =                                                        #動态注冊

   (DESCRIPTION_LIST =

     (DESCRIPTION =

       (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))

     )

     (DESCRIPTION =

       (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.66)(PORT = 1521))

     )

   )   [[email protected] admin]$   lsnrctl status LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 01-MAR-2012 01:14:03 Copyright (c) 1991, 2005, Oracle.   All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))

STATUS of the LISTENER

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

Alias                      LISTENER

Version                    TNSLSNR for Linux: Version 10.2.0.1.0 - Production

Start Date                 01-MAR-2012 01:13:04

Uptime                     0 days 0 hr. 0 min. 58 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.log

Listening Endpoints Summary...

   (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))

   (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.2.66)(PORT=1521)))

Services Summary...

Service "PLSExtProc" has 1 instance(s).

   Instance "PLSExtProc", status   UNKNOWN, has 1 handler(s) for this service...

Service "ocp" has 1 instance(s).

   Instance "ocp", status UNKNOWN, has 1 handler(s) for this service...

Service "orcl.oracle.com" has 2 instance(s).

   Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...

   Instance "orcl", status   READY, has 1 handler(s) for this service...

Service "orclXDB.oracle.com" has 1 instance(s).

   Instance "orcl", status READY, has 1 handler(s) for this service...

Service "orcl_XPT.oracle.com" has 1 instance(s).

   Instance "orcl", status READY, has 1 handler(s) for this service...

The command completed successfully

  UNKNOWN表示靜态注冊, READY表示動态注冊   ================================================================================================= 以下轉于 http://blog.itpub.net/post/37743/511624, 未驗證   由于動态注冊需要pmon程序,是以監聽必須在資料庫啟動之前啟動,否則動态注冊将失敗;在資料庫運作的過程中,如果重新開機監聽也會造成動态注冊失敗

動态注冊隻是注冊預設的監聽器上(名稱是listener、端口是1521、協定時TCP),如果需要向非預設的監聽注冊,則需要改變local_listener參數

将監聽的資訊添加到tnsnames.ora 檔案中。 注意,是tnsnames.ora 檔案, 因為pmon在動态注冊監聽時要從tnsnames.ora中讀取相關資訊。

LISTENER =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = DaveDai)(PORT = 1522))

)

然後以sys用戶運作:

SQL> alter system set local_listener=listener;

SQL> alter system register;

或者:

SQL> alter system set LOCAL_LISTENER='(ADDRESS = (PROTOCOL = TCP)(HOST = DaveDai)(PORT = 1522))';

SQL> alter system register;

動态注冊的好處是簡單友善,但是容易發生注冊失敗

轉載于:https://blog.51cto.com/dongdongdong/843540