oracle監聽器動態註冊於靜態註冊的區別

hd_system發表於2016-11-12

1, oracle 10g 用netca方式建立的都預設為動態註冊方式
2,如果想改為靜態註冊的方式則在listener.ora 中加入如下內容即可
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 =
(SID_NAME = JEFF )
(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1) --就這一段
(GLOBAL_DBNAME = jeff)
)
)

LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = r1)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)

3,兩者的區別
即靜態註冊,listener不知道例項的狀態,只有在程式透過其連線資料庫時才能知道,如果你想使用遠端管理資料庫就使用靜態監聽
動態註冊:listener實時的都知道例項的狀態,資料庫在關閉的時候會動態的從listener中登出,所以遠端管理資料庫的啟動和停止就不行了。

4,如何判斷是靜態註冊還是動態註冊
(1) 可以透過配置檔案判斷

動態註冊

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (PROGRAM = extproc)
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = D:\oradata\orcl)
    )
  )

靜態註冊

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (PROGRAM = extproc)
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = D:\oradata\orcl)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = orcl)
      (ORACLE_HOME = D:\oradata\orcl)
      (SID_NAME = ORCL)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = orcl1)
      (ORACLE_HOME = D:\oradata\orcl)
      (SID_NAME = ORCL)
    )
  )

透過檢視雖然可以大致看出,但是這種方法並不能和明確的現實資料庫在執行時的實際情況


(2) lsnrclt status

----靜態註冊是這樣的 都是unknow
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "jeff" has 1 instance(s).
Instance "JEFF", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


-----動態註冊是這樣的
Services Summary...
Service "JEFF" has 1 instance(s).
Instance "JEFF", status READY, has 1 handler(s) for this service...
Service "JEFFXDB" has 1 instance(s).
Instance "JEFF", status READY, has 1 handler(s) for this service...
Service "JEFF_XPT" has 1 instance(s).
Instance "JEFF", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


3,有時候會碰到即使listener起來也不能連線到資料庫的情況 。會報一個ORA-12514 ,

執行lsnrctls status 是這個樣子的 ,說明沒有服務沒有註冊進來

Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=r1)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

解決方法:
alter system register; ---手動將服務註冊到listener中


4,如果我想使用動態註冊,但是又不想使用1521埠怎麼辦
這個時候我們就要用到 local_listener這個引數了,當你使用的是其他埠比如說是1522埠,那麼只要配置這個引數就ok了。
SQL> alter system set local_listener='(DESCRIPTION =
2 (ADDRESS = (PROTOCOL = TCP)(HOST = xys)(PORT = 1522))
3 )';

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29209863/viewspace-2128327/,如需轉載,請註明出處,否則將追究法律責任。

相關文章