<acronym id="ypi11"></acronym>
    <span id="ypi11"><blockquote id="ypi11"><nav id="ypi11"></nav></blockquote></span>
  1. <acronym id="ypi11"></acronym>
    當前位置:首頁 博文天下 使用“alter system register;”解決動態監聽注冊緩慢問題

    使用“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;”命令加速。

    訂閱我們的電子報刊,掌握最新資訊

    博文天下

    Prev Next

    弱電工程簡介

    綜合布線 智能家居 程控數字電話 閉路監控 防盜報警 智能一卡通 背景音樂及公共廣播

    公司簡介

    蘇州柯瑞德信息系統是一家優秀的專注于為中小型企業提供信息系統集成服務的企業。我們的IT工程師都具備國際認證的微軟、思科等專家證書,我們以專業的服務、合...

    關于柯瑞德信息系統有限公司

    關于柯瑞德信息系統有限公司

    將您企業中的IT部門的職能全部或部分外包,集中精力發展您企業的核心業務! ? ??????? 蘇州柯瑞德信息系統有限公司是一家...

    快速聯系我們






    智能家居

    Prev Next
    電子圍欄與紅外對射的區別

    電子圍欄與紅外對射的區別

    ??????? 隨著我國經濟建設的發展,周界安全防范工作正日益引起重視,電子圍欄的出現徹底改變了人們對安全防護工作理念的認識。   我國周界安全...

    智能一卡通管理系統

    智能一卡通管理系統

      智能一卡通管理系統(Smart Manager) ,即一卡通行解決方案,本系統集合門禁、考勤、消費、停車場、電梯、巡更、電子地圖、管理中...

    什么是門禁 ? 當前常見門禁系統的種類有哪些?各有什么優缺點?

    什么是門禁 ? 當前常見門禁系統的種類有哪些?各有什么優缺點…

    門禁 , 又稱出入管理控制系統 通道管理系統. 是一種管理人員進出的數字化智能管理系統 .原始的門禁系統概念其實早就在我們生活 中。例如:我們家家...

    在線狀態

    目前有 17?游客 和 0個會員 在線

    少妇激情一区二区三区视频