[20170120]監聽重新開機問題2.txt
--今天重新開機一台容災的伺服器的監聽,想都沒想直接lsnrctl stop,lsnrctl start.結果使用者連接配接出現問題.
--隻要不清楚這套系統的工作機制,自己在測試環境做一個測試,主要問題是監聽配置修改了監聽的别名.
1.環境:
SYS@book> @ &r/ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
2.一般監聽的配置如下:
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
#SUBSCRIBE_FOR_NODE_DOWN_EVENT_LISTENER=OFF
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SDU=32767)
(GLOBAL_DBNAME = book)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)
(SID_NAME = book)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521)(RATE_LIMIT=YES))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.100.78)(PORT = 1521)(RATE_LIMIT=YES))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
ADR_BASE_LISTENER = /u01/app/oracle
DIAG_ADR_ENABLED_LISTENER=OFF
USE_NS_PROBES_FOR_DCD=true
#DYNAMIC_REGISTRATION_LISTENER = off
INBOUND_CONNECT_TIMEOUT_LISTENER=100
CONNECTION_RATE_LISTENER=5
--//監聽的别名是預設LISTENER,這個是大部分單機資料庫的配置.
3.而我們容災的資料庫使用别名,修改如下:
#SID_LIST_LISTENER =
SID_LIST_AAAA =
#LISTENER =
AAAA =
4.現在重新開機監聽:
--如果按照平時的操作,我習慣執行如下:
$ lsnrctl stop;sleep 1;lsnrctl start
$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 20-JAN-2017 11:35:26
Copyright (c) 1991, 2013, 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.4.0 - Production
Start Date 20-JAN-2017 11:34:38
Uptime 0 days 0 hr. 0 min. 48 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/11.2.0.4/dbhome_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=gxqyydg4)(PORT=1521)))
The listener supports no services
The command completed successfully
SYS@book> alter system register ;
System altered.
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 20-JAN-2017 11:35:49
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Uptime 0 days 0 hr. 1 min. 11 sec
Services Summary...
Service "book" has 1 instance(s).
Instance "book", status READY, has 2 handler(s) for this service...
Service "bookXDB" has 1 instance(s).
Instance "book", status READY, has 1 handler(s) for this service...
--//注意看~~,别名是LISTENER,靜态注冊的監聽不存在,我現在還搞不懂為什麼會影響這套容災系統.僅僅不存在靜态注冊的監聽.
5.正确的啟動方式:
lsnrctl stop;sleep 1;lsnrctl start aAAA
--//注:AAAA大小寫一樣,都沒有問題
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 20-JAN-2017 11:40:26
Alias aAAA
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Start Date 20-JAN-2017 11:40:11
Uptime 0 days 0 hr. 0 min. 14 sec
Listener Log File /u01/app/oracle/diag/tnslsnr/gxqyydg4/aaaa/alert/log.xml
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.78)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Service "book" has 2 instance(s).
Instance "book", status UNKNOWN, has 1 handler(s) for this service...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--//注意看~~.别名現在是aAAA. 靜态監聽也注冊了.
$ ps -ef | grep tnslsn[r]
oracle 59355 1 0 11:40 ? 00:00:00 /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/tnslsnr aAAA -inherit
--而如果執行前面的lsnrctl stop;sleep 1;lsnrctl start
oracle 59385 1 4 11:44 ? 00:00:00 /u01/app/oracle/product/11.2.0.4/dbhome_1/bin/tnslsnr LISTENER -inherit
6.總結:
--//重點問題不了解這套系統的工作機制.以後注意這些細節.缺少必要的文檔,或者我根本沒看這方面的文檔.