【LISTENER】使用“alter system register;”解決動態監聽註冊緩慢問題
感受一下Oracle資料庫例項的動態監聽註冊細節。有如下這樣一個規律,先總結在這裡:
①如果是先啟動監聽,後啟動資料庫例項,則動態監聽會自動識別到啟動的資料庫例項;
②在資料庫例項正常執行的情況下重啟監聽,則資料庫例項會等很長時間才能在動態監聽中註冊成功,大約需要1分鐘的等待時間;
③如果是先啟動資料庫例項,後啟動監聽,效果和②一樣;
④如果不希望長時間等待動態監聽註冊的過程,可以使用“alter system register;”命令加速。
真實的體驗一下這個過程。切身體驗之後這些結論將顯得那樣的自然和純真。
1.第①種場景模擬
1)在資料庫例項未啟動時啟動監聽程式
ora11g@secdb /home/oracle$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue Jan 18 20:47:22 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
NotConnected@> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:48:58
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 29-DEC-2010 02:03:55
Uptime 20 days 18 hr. 45 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
The listener supports no services
The command completed successfully
因為資料庫例項沒有啟動,監聽理所當然地處於未檢測到任何例項的狀態。
2)啟動資料庫例項
NotConnected@> startup;
ORACLE instance started.
Total System Global Area 535662592 bytes
Fixed Size 1337720 bytes
Variable Size 411043464 bytes
Database Buffers 117440512 bytes
Redo Buffers 5840896 bytes
Database mounted.
Database opened.
3)隨即檢視監聽狀態
sys@ora11g> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:49:15
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 29-DEC-2010 02:03:55
Uptime 20 days 18 hr. 45 min. 20 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
Services Summary...
Service "ora11g" has 1 instance(s).
Instance "ora11g", status READY, has 1 handler(s) for this service...
The command completed successfully
第①種場景結論得到印證:
①如果是先啟動監聽,後啟動資料庫例項,則動態監聽會自動識別到啟動的資料庫例項;
2.第②種場景模擬
1)手工停啟監聽程式
sys@ora11g> !lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:52:55
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
sys@ora11g> !lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:53:03
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /oracle/ora11gR2/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 20:53:03
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
The listener supports no services
The command completed successfully
2)每隔一秒檢查一下監聽的狀態
sys@ora11g> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:53:11
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 20:53:03
Uptime 0 days 0 hr. 0 min. 7 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
The listener supports no services
The command completed successfully
……省略部分狀態檢查資訊……
sys@ora11g> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:53:14
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 20:53:03
Uptime 0 days 0 hr. 0 min. 11 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
The listener supports no services
The command completed successfully
……省略部分狀態檢查資訊……
sys@ora11g> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:53:22
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 20:53:03
Uptime 0 days 0 hr. 0 min. 18 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
The listener supports no services
The command completed successfully
……省略部分狀態檢查資訊……
sys@ora11g> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:53:58
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 20:53:03
Uptime 0 days 0 hr. 0 min. 55 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
The listener supports no services
The command completed successfully
可見,直到20:53:58時資料庫例項仍然沒有註冊到監聽中,此時距離啟動監聽的時候20:53:03已經過去55秒。
最後是在20:53:59成功完成註冊。
sys@ora11g> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:53:59
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 20:53:03
Uptime 0 days 0 hr. 0 min. 56 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
Services Summary...
Service "ora11g" has 1 instance(s).
Instance "ora11g", status READY, has 1 handler(s) for this service...
The command completed successfully
距離啟動監聽時間56秒,大約用了1分鐘的時間才完成資料庫例項到監聽的動態註冊。
第②種場景結論得到印證:
②如果是先啟動資料庫例項,後啟動監聽,則資料庫例項會等很長時間才能在動態監聽中註冊成功,大約需要1分鐘的等待時間;
3.第③種場景和第②種場景式樣的,不贅述。
4.第④種場景模擬
模擬這個場景比較簡單,只需要連續執行如下這幾條命令即可。
!lsnrctl stop
!lsnrctl start
!lsnrctl status
alter system register;
!lsnrctl status
以下是連續執行後的結果。
1)停止監聽程式
sys@ora11g> !lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 21:30:40
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
2)啟動監聽程式
sys@ora11g> !lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 21:30:44
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /oracle/ora11gR2/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 21:30:44
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
The listener supports no services
The command completed successfully
3)檢視監聽狀態
sys@ora11g> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 21:30:44
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 21:30:44
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
The listener supports no services
The command completed successfully
此時,監聽未檢測到資料庫例項資訊。
4)手工強制將資料庫例項註冊到監聽
sys@ora11g> alter system register;
System altered.
5)最後確認監聽狀態
sys@ora11g> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 21:30:44
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 21:30:44
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
Services Summary...
Service "ora11g" has 1 instance(s).
Instance "ora11g", status READY, has 1 handler(s) for this service...
The command completed successfully
透過手工註冊資料庫例項的方法,立杆見影,例項旋即註冊到了監聽程式中。
第④種場景結論得到印證:
④如果不希望長時間等待動態監聽註冊的過程,可以使用“alter system register;”命令加速。
5.小結
如果您能將這個過程“躬親”一下,也許會有這種很美妙的感覺:一切都是那樣的自然而和諧。
再次將有關動態監聽的結論附在這裡:
①如果是先啟動監聽,後啟動資料庫例項,則動態監聽會自動識別到啟動的資料庫例項;
②在資料庫例項正常執行的情況下重啟監聽,則例項會等很長時間才能在動態監聽中註冊成功,大約需要1分鐘的等待時間;
③如果是先啟動資料庫例項,後啟動監聽,效果和②一樣;
④如果不希望長時間等待動態監聽註冊的過程,可以使用“alter system register;”命令加速。
Good luck.
secooler
11.01.18
-- The End --
①如果是先啟動監聽,後啟動資料庫例項,則動態監聽會自動識別到啟動的資料庫例項;
②在資料庫例項正常執行的情況下重啟監聽,則資料庫例項會等很長時間才能在動態監聽中註冊成功,大約需要1分鐘的等待時間;
③如果是先啟動資料庫例項,後啟動監聽,效果和②一樣;
④如果不希望長時間等待動態監聽註冊的過程,可以使用“alter system register;”命令加速。
真實的體驗一下這個過程。切身體驗之後這些結論將顯得那樣的自然和純真。
1.第①種場景模擬
1)在資料庫例項未啟動時啟動監聽程式
ora11g@secdb /home/oracle$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Tue Jan 18 20:47:22 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
NotConnected@> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:48:58
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 29-DEC-2010 02:03:55
Uptime 20 days 18 hr. 45 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
The listener supports no services
The command completed successfully
因為資料庫例項沒有啟動,監聽理所當然地處於未檢測到任何例項的狀態。
2)啟動資料庫例項
NotConnected@> startup;
ORACLE instance started.
Total System Global Area 535662592 bytes
Fixed Size 1337720 bytes
Variable Size 411043464 bytes
Database Buffers 117440512 bytes
Redo Buffers 5840896 bytes
Database mounted.
Database opened.
3)隨即檢視監聽狀態
sys@ora11g> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:49:15
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 29-DEC-2010 02:03:55
Uptime 20 days 18 hr. 45 min. 20 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
Services Summary...
Service "ora11g" has 1 instance(s).
Instance "ora11g", status READY, has 1 handler(s) for this service...
The command completed successfully
第①種場景結論得到印證:
①如果是先啟動監聽,後啟動資料庫例項,則動態監聽會自動識別到啟動的資料庫例項;
2.第②種場景模擬
1)手工停啟監聽程式
sys@ora11g> !lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:52:55
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
sys@ora11g> !lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:53:03
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /oracle/ora11gR2/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 20:53:03
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
The listener supports no services
The command completed successfully
2)每隔一秒檢查一下監聽的狀態
sys@ora11g> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:53:11
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 20:53:03
Uptime 0 days 0 hr. 0 min. 7 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
The listener supports no services
The command completed successfully
……省略部分狀態檢查資訊……
sys@ora11g> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:53:14
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 20:53:03
Uptime 0 days 0 hr. 0 min. 11 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
The listener supports no services
The command completed successfully
……省略部分狀態檢查資訊……
sys@ora11g> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:53:22
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 20:53:03
Uptime 0 days 0 hr. 0 min. 18 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
The listener supports no services
The command completed successfully
……省略部分狀態檢查資訊……
sys@ora11g> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:53:58
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 20:53:03
Uptime 0 days 0 hr. 0 min. 55 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
The listener supports no services
The command completed successfully
可見,直到20:53:58時資料庫例項仍然沒有註冊到監聽中,此時距離啟動監聽的時候20:53:03已經過去55秒。
最後是在20:53:59成功完成註冊。
sys@ora11g> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 20:53:59
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 20:53:03
Uptime 0 days 0 hr. 0 min. 56 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
Services Summary...
Service "ora11g" has 1 instance(s).
Instance "ora11g", status READY, has 1 handler(s) for this service...
The command completed successfully
距離啟動監聽時間56秒,大約用了1分鐘的時間才完成資料庫例項到監聽的動態註冊。
第②種場景結論得到印證:
②如果是先啟動資料庫例項,後啟動監聽,則資料庫例項會等很長時間才能在動態監聽中註冊成功,大約需要1分鐘的等待時間;
3.第③種場景和第②種場景式樣的,不贅述。
4.第④種場景模擬
模擬這個場景比較簡單,只需要連續執行如下這幾條命令即可。
!lsnrctl stop
!lsnrctl start
!lsnrctl status
alter system register;
!lsnrctl status
以下是連續執行後的結果。
1)停止監聽程式
sys@ora11g> !lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 21:30:40
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
2)啟動監聽程式
sys@ora11g> !lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 21:30:44
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /oracle/ora11gR2/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 21:30:44
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
The listener supports no services
The command completed successfully
3)檢視監聽狀態
sys@ora11g> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 21:30:44
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 21:30:44
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
The listener supports no services
The command completed successfully
此時,監聽未檢測到資料庫例項資訊。
4)手工強制將資料庫例項註冊到監聽
sys@ora11g> alter system register;
System altered.
5)最後確認監聽狀態
sys@ora11g> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 18-JAN-2011 21:30:44
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 18-JAN-2011 21:30:44
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/ora11gR2/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /oracle/ora11gR2/diag/tnslsnr/secdb/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=secdb)(PORT=1521)))
Services Summary...
Service "ora11g" has 1 instance(s).
Instance "ora11g", status READY, has 1 handler(s) for this service...
The command completed successfully
透過手工註冊資料庫例項的方法,立杆見影,例項旋即註冊到了監聽程式中。
第④種場景結論得到印證:
④如果不希望長時間等待動態監聽註冊的過程,可以使用“alter system register;”命令加速。
5.小結
如果您能將這個過程“躬親”一下,也許會有這種很美妙的感覺:一切都是那樣的自然而和諧。
再次將有關動態監聽的結論附在這裡:
①如果是先啟動監聽,後啟動資料庫例項,則動態監聽會自動識別到啟動的資料庫例項;
②在資料庫例項正常執行的情況下重啟監聽,則例項會等很長時間才能在動態監聽中註冊成功,大約需要1分鐘的等待時間;
③如果是先啟動資料庫例項,後啟動監聽,效果和②一樣;
④如果不希望長時間等待動態監聽註冊的過程,可以使用“alter system register;”命令加速。
Good luck.
secooler
11.01.18
-- The End --
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/21302630/viewspace-1744069/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 動態註冊監聽Listener
- ORACLE之手動註冊監聽listener。alter system set local_listener="XXX"Oracle
- 聊聊跟蹤監聽器動態註冊(Dynamic Register)方法
- 【LISTENER】修改 LISTENER的監聽埠為1526(動態註冊)
- oracle 監聽器動態與靜態註冊服務_listenerOracle
- 監聽動態註冊
- 動態註冊監聽
- 動態監聽註冊
- 【監聽】動態註冊和靜態註冊
- rac監聽動態註冊
- Oracle 動態監聽註冊Oracle
- oracle監聽靜態註冊和動態註冊Oracle
- oracle監聽動態註冊與靜態註冊Oracle
- Oracle監聽器的靜態註冊與動態註冊,以及DB_DOMAIN問題OracleAI
- 【LISTENER】修改 LISTENER的監聽埠為1526(靜態註冊)
- 【LISTENER】Oracle通過監聽連線緩慢分析Oracle
- Oracle監聽的靜態註冊和動態註冊Oracle
- Oracle監聽的動態註冊與靜態註冊Oracle
- rac監聽不能動態註冊
- ORACLE啟動監聽器 The listener supports no services 問題解決方法Oracle
- oracle監聽動態註冊與靜態註冊[轉帖]Oracle
- Oracle動態監聽註冊測試Oracle
- HPUX 監聽無法動態註冊UX
- listener的動態註冊
- Oracle Listener 動態註冊 與 靜態註冊Oracle
- Oracle listener靜態註冊和動態註冊Oracle
- Oracle Listener 動態註冊與靜態註冊Oracle
- Oracle 靜態監聽註冊詳解Oracle
- ORACLE監聽器 The listener supports no services 問題解決方法Oracle
- ORACLE 動態註冊,靜態註冊,多個監聽,一個監聽多個埠配置Oracle
- oracle監聽之動態和靜態註冊Oracle
- listener靜態註冊和動態註冊總結
- oracle監聽器動態註冊於靜態註冊的區別Oracle
- 【原創】Oracle的動態監聽註冊Oracle
- 【listener】oracle靜態監聽和動態監聽 【轉載】Oracle
- 關於Listener動態註冊
- oracle監聽器的靜態和動態註冊Oracle
- oracle動態和靜態監聽listenerOracle