實現Oracle非1521標準埠動態註冊
<p style="text-indent:2em;">
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">動態註冊</span><span style="font-size:12pt;">dynamic registry</span><span style="font-family:宋體;font-size:12pt;">和靜態註冊是</span><span style="font-size:12pt;">Oracle</span><span style="font-family:宋體;font-size:12pt;">例項和監聽器之間建立聯絡的重要方式。從現在趨勢看,預設監聽器</span><span style="font-size:12pt;">+</span><span style="font-family:宋體;font-size:12pt;">動態註冊已經成為預設</span><span style="font-size:12pt;">Oracle</span><span style="font-family:宋體;font-size:12pt;">標準配置。在一些場景下,處於安全的原因可能需要修改標準監聽配置和註冊方式。本篇主要介紹如何實現非</span><span style="font-size:12pt;">1521</span><span style="font-family:宋體;font-size:12pt;">埠進行動態註冊方法。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<b><span style="font-size:12pt;">1</span></b><b><span style="font-family:宋體;font-size:12pt;">、預設監聽與</span></b><b><span style="font-size:12pt;">1521</span></b><b><span style="font-family:宋體;font-size:12pt;">埠</span></b><b><span style="font-size:12pt;"></span></b>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;">Oracle Net Service</span><span style="font-family:宋體;font-size:12pt;">核心三個配置檔案:</span><span style="font-size:12pt;">listener.ora</span><span style="font-family:宋體;font-size:12pt;">、</span><span style="font-size:12pt;">tnsnames.ora</span><span style="font-family:宋體;font-size:12pt;">和</span><span style="font-size:12pt;">sqlnet.ora</span><span style="font-family:宋體;font-size:12pt;">。其中,</span><span style="font-size:12pt;">listener.ora</span><span style="font-family:宋體;font-size:12pt;">檔案為監聽器相關資訊的配置檔案。關於監聽器個性化引數內容,均在該檔案中設定。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">在預設安裝情況下,我們一般在</span><span style="font-size:12pt;">$ORACLE_HOME/network/admin</span><span style="font-family:宋體;font-size:12pt;">目錄中是可以沒有</span><span style="font-size:12pt;">listener.ora</span><span style="font-family:宋體;font-size:12pt;">檔案的。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">[oracle@aaalife admin]$ ls -l</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">-rw-r-----. 1 oracle oinstall<span> </span>332 Aug<span> </span>7 01:44 tnsnames.ora</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">此時,</span><span style="font-size:12pt;">Oracle</span><span style="font-family:宋體;font-size:12pt;">會在</span><span style="font-size:12pt;">1521</span><span style="font-family:宋體;font-size:12pt;">預設埠,支援一個預設配置檔案的監聽器程式。並且,該程式支援動態註冊功能。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">[oracle@aaalife admin]$ lsnrctl start</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 01:08:10</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Copyright (c) 1991, 2013, Oracle.<span> </span>All rights reserved.</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">TNSLSNR for Linux: Version 11.2.0.4.0 - Production</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Log messages written to /u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Connecting to <span style="color:red;">(ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))</span></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">STATUS of the LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">------------------------</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Alias<span> </span>LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Version<span> </span>TNSLSNR for Linux: Version 11.2.0.4.0 - Production</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Start Date<span> </span>07-SEP-2015 01:08:10</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Uptime<span> </span>0 days 0 hr. 0 min. 0 sec</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Trace Level<span> </span>off</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Security<span> </span>ON: Local OS Authentication</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">SNMP<span> </span>OFF</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">--</span><span style="font-family:宋體;font-size:12pt;">此處沒有說明監聽器配置檔案路徑。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Listener Log File<span> </span>/u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listening Endpoints Summary...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"><span> </span>(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">The listener supports no services</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">The command completed successfully</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">對註冊行為另一端的</span><span style="font-size:12pt;">Oracle</span><span style="font-family:宋體;font-size:12pt;">例項而言,預設情況下</span><span style="font-size:12pt;">Oracle</span><span style="font-family:宋體;font-size:12pt;">例項會進行動態註冊動作,會向</span><span style="font-size:12pt;">1521</span><span style="font-family:宋體;font-size:12pt;">埠監聽的監聽程式進行註冊動作。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">[oracle@aaalife admin]$ lsnrctl status</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 01:14:54</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Copyright (c) 1991, 2013, Oracle.<span> </span>All rights reserved.</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">STATUS of the LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">------------------------</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Alias<span> </span>LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Version<span> </span>TNSLSNR for Linux: Version 11.2.0.4.0 - Production</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Start Date<span> </span>07-SEP-2015 01:08:10</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Uptime<span> </span>0 days 0 hr. 6 min. 43 sec</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Trace Level<span> </span>off</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Security<span> </span>ON: Local OS Authentication</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">SNMP<span> </span>OFF</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listener Log File<span> </span>/u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listening Endpoints Summary...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"><span> </span>(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Services Summary...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Service "aaadb" has 1 instance(s).</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;"><span> </span>Instance "aaadb", status READY, has 1 handler(s) for this service...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Service "aaadbXDB" has 1 instance(s).</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;"><span> </span>Instance "aaadb", status READY, has 1 handler(s) for this service...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">The command completed successfully</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<b><span style="font-size:12pt;">2</span></b><b><span style="font-family:宋體;font-size:12pt;">、非預設埠監聽器</span></b><b><span style="font-size:12pt;"></span></b>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">在一些安全需求場景下,我們會被要求修改監聽埠到非</span><span style="font-size:12pt;">1521</span><span style="font-family:宋體;font-size:12pt;">埠,從而避免被掃描入侵。其實,這對於攻擊掃描程式來講,意義不大,因為一般駭客攻擊都會掃描所有埠。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">如果我們需要修改埠號,就必須建立專門的</span><span style="font-size:12pt;">listener.ora</span><span style="font-family:宋體;font-size:12pt;">檔案內容來進行配置。下面內容可以配置一個非標準監聽器程式。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">[oracle@aaalife admin]$ cat listener.ora </span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"># listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"># Generated by Oracle configuration tools.</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">MY_LISTENER</span><span style="font-size:12pt;"> =</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"><span> </span>(DESCRIPTION_LIST =</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"><span> </span>(DESCRIPTION =</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"><span> </span>(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(<span style="color:red;">PORT = 1531</span>))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"><span> </span>(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1531))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"><span> </span>)</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"><span> </span>)</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">ADR_BASE_LISTENER = /u01/app/oracle</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">配置檔案中,包括一個</span><span style="font-size:12pt;">1531</span><span style="font-family:宋體;font-size:12pt;">埠的監聽程式。下面檢視監聽器情況。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">[oracle@aaalife admin]$ lsnrctl start</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 01:27:53</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Copyright (c) 1991, 2013, Oracle.<span> </span>All rights reserved.</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">TNSLSNR for Linux: Version 11.2.0.4.0 - Production</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Log messages written to /u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">STATUS of the LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">------------------------</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Alias<span> </span>LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Version<span> </span>TNSLSNR for Linux: Version 11.2.0.4.0 - Production</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Start Date<span> </span>07-SEP-2015 01:27:53</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Uptime<span> </span>0 days 0 hr. 0 min. 0 sec</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Trace Level<span> </span>off</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Security<span> </span>ON: Local OS Authentication</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">SNMP<span> </span>OFF</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Listener Parameter File<span> </span>/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listener Log File<span> </span>/u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Listening Endpoints Summary...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;"><span> </span>(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">The listener supports no services</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">The command completed successfully</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">預設顯示的還有</span><span style="font-size:12pt;">1521</span><span style="font-family:宋體;font-size:12pt;">埠監聽程式。同時,發現其實當前伺服器上是由兩個監聽器執行的。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">[oracle@aaalife admin]$ lsnrctl status<span style="color:red;"> listener</span></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 01:30:13</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Copyright (c) 1991, 2013, Oracle.<span> </span>All rights reserved.</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">STATUS of the LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">------------------------</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Alias<span> </span>LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Version<span> </span>TNSLSNR for Linux: Version 11.2.0.4.0 - Production</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Start Date<span> </span>07-SEP-2015 01:27:53</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Uptime<span> </span>0 days 0 hr. 2 min. 19 sec</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Trace Level<span> </span>off</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Security<span> </span>ON: Local OS Authentication</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">SNMP<span> </span>OFF</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listener Parameter File<span> </span>/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listener Log File<span> </span>/u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Listening Endpoints Summary...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;"><span> </span>(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Services Summary...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Service "aaadb" has 1 instance(s).</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;"><span> </span>Instance "aaadb", status READY, has 1 handler(s) for this service...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Service "aaadbXDB" has 1 instance(s).</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;"><span> </span>Instance "aaadb", status READY, has 1 handler(s) for this service...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">The command completed successfully</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">[oracle@aaalife admin]$ </span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-align:left;text-indent:2em;background:#eeece1;" align="left">
<span style="font-size:12pt;">[oracle@aaalife admin]$<span style="color:red;"> lsnrctl status my_listener</span></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 01:30:29</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Copyright (c) 1991, 2013, Oracle.<span> </span>All rights reserved.</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1531)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">STATUS of the LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">------------------------</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Alias<span> </span>LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Version<span> </span>TNSLSNR for Linux: Version 11.2.0.4.0 - Production</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Start Date<span> </span>07-SEP-2015 01:17:52</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Uptime<span> </span>0 days 0 hr. 12 min. 37 sec</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Trace Level<span> </span>off</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Security<span> </span>ON: Local OS Authentication</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">SNMP<span> </span>OFF</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listener Parameter File<span> </span>/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listener Log File<span> </span>/u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Listening Endpoints Summary...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;"><span> </span>(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1531)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;"><span> </span>(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1531)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">The listener supports no services</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">The command completed successfully</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;">上面資訊顯示出幾個細節:</span><span></span>
</p>
<p style="text-indent:2em;">
<span></span>
</p>
<p style="text-indent:2em;margin-left:21pt;">
<span style="font-family:Wingdings;"><span>ü<span> </span></span></span><span style="font-family:宋體;">我們在</span><span>listener.ora</span><span style="font-family:宋體;">檔案中配置了一個自定義監聽器</span><span>my_listener</span><span style="font-family:宋體;">,監聽</span><span>1531</span><span style="font-family:宋體;">埠。但是系統當前預設監聽器依然存在,並且可執行,在</span><span>1521</span><span style="font-family:宋體;">埠。</span><span>my_listener</span><span style="font-family:宋體;">監聽器執行在</span><span>1531</span><span style="font-family:宋體;">埠;</span><span></span>
</p>
<p style="text-indent:2em;margin-left:21pt;">
<span style="font-family:Wingdings;"><span>ü<span> </span></span></span><span>Oracle</span><span style="font-family:宋體;">例項動態註冊動作是在</span><span>1521</span><span style="font-family:宋體;">埠的監聽程式上進行的,</span><span>1531</span><span style="font-family:宋體;">埠並沒有被註冊;</span><span></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">預設監聽器的問題好解決,只要我們只保留一個監聽即可。那麼,如何讓</span><span style="font-size:12pt;">Oracle</span><span style="font-family:宋體;font-size:12pt;">例項在</span><span style="font-size:12pt;">1531</span><span style="font-family:宋體;font-size:12pt;">埠進行註冊,不在</span><span style="font-size:12pt;">1521</span><span style="font-family:宋體;font-size:12pt;">埠進行註冊呢?</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">解決的方法就是使用</span><span style="font-size:12pt;">local_listener</span><span style="font-family:宋體;font-size:12pt;">配置引數。預設情況下,該引數為空。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">SQL> show parameter listener;</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">NAME<span> </span>TYPE<span> </span>VALUE</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">------------------------------------ ----------- ------------------------------</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">listener_networks<span> </span>string</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">local_listener<span> </span>string</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">remote_listener<span> </span>string</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">該引數用於明確指定</span><span style="font-size:12pt;">Oracle</span><span style="font-family:宋體;font-size:12pt;">例項向哪一個監聽器上進行註冊動作。通常對於非標準埠註冊,都需要將註冊監聽資訊修改引數。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">SQL> show parameter local</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">NAME<span> </span>TYPE<span> </span>VALUE</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">------------------------------------ ----------- ------------------------------</span>
</p>
<p style="text-indent:2em;background:#eeece1;margin-left:192pt;">
<span style="color:red;font-size:12pt;">local_listener<span> </span>string<span> </span>(ADDRESS_LIST=(Address=(Protoc<span> </span>ol=tcp)(HOST=AAALIFE)(Port=1531)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">log_archive_local_first<span> </span>boolean<span> </span>TRUE</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">parallel_force_local<span> </span>boolean<span> </span>FALSE</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">注意:該引數</span><span style="font-size:12pt;">local_listener</span><span style="font-family:宋體;font-size:12pt;">修改範圍支援</span><span style="font-size:12pt;">both</span><span style="font-family:宋體;font-size:12pt;">方式,立即生效不需要重新啟動例項。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">此時,監聽器狀態如下:</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">[oracle@aaalife dbs]$ lsnrctl status</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 02:32:25</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Copyright (c) 1991, 2013, Oracle.<span> </span>All rights reserved.</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">STATUS of the LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">------------------------</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Alias<span> </span>LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Version<span> </span>TNSLSNR for Linux: Version 11.2.0.4.0 - Production</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Start Date<span> </span>07-SEP-2015 01:27:53</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Uptime<span> </span><span> </span>0 days 1 hr. 4 min. 32 sec</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Trace Level<span> </span>off</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Security<span> </span>ON: Local OS Authentication</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">SNMP<span> </span>OFF</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listener Parameter File<span> </span>/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listener Log File<span> </span>/u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Listening Endpoints Summary...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;"><span> </span>(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">The listener supports no services</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">The command completed successfully</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">[oracle@aaalife dbs]$ <span style="color:red;">lsnrctl status my_listener</span></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 02:32:33</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Copyright (c) 1991, 2013, Oracle.<span> </span>All rights reserved.</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1531)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">STATUS of the LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">------------------------</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Alias<span> </span>LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Version<span> </span>TNSLSNR for Linux: Version 11.2.0.4.0 - Production</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Start Date<span> </span>07-SEP-2015 01:17:52</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Uptime<span> </span>0 days 1 hr. 14 min. 41 sec</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Trace Level<span> </span>off</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Security<span> </span>ON: Local OS Authentication</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">SNMP<span> </span>OFF</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listener Parameter File<span> </span>/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listener Log File<span> </span>/u01/app/oracle/diag/tnslsnr/aaalife/listener/alert/log.xml</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Listening Endpoints Summary...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;"><span> </span>(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1531)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;"><span> </span>(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1531)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Services Summary...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Service "aaadb" has 1 instance(s).</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;"><span> </span>Instance "aaadb", status READY, has 1 handler(s) for this service...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Service "aaadbXDB" has 1 instance(s).</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;"><span> </span>Instance "aaadb", status READY, has 1 handler(s) for this service...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">The command completed successfully</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">例項向</span><span style="font-size:12pt;">1531</span><span style="font-family:宋體;font-size:12pt;">埠進行動態註冊了,原有</span><span style="font-size:12pt;">1521</span><span style="font-family:宋體;font-size:12pt;">預設監聽器沒有註冊資訊。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">那麼,還有一個問題,就是</span><span style="font-size:12pt;">local_listener</span><span style="font-family:宋體;font-size:12pt;">設定值。該值採用括號表示式進行書寫,是</span><span style="font-size:12pt;">Oracle Net Service</span><span style="font-family:宋體;font-size:12pt;">內部使用的一種方式。從管理角度看,這種策略不是很好的方法。我們直接將埠編號書寫在資料庫引數中,不但容易洩露部署資訊,而且在發生遷移、變更動作的時候,這種方式也會有一些問題。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">所以,</span><span style="font-size:12pt;">Oracle</span><span style="font-family:宋體;font-size:12pt;">官方支援監聽器別名方法進行配置</span><span style="font-size:12pt;">local_listener</span><span style="font-family:宋體;font-size:12pt;">。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<b><span style="font-size:12pt;">3</span></b><b><span style="font-family:宋體;font-size:12pt;">、設定監聽器別名</span></b><b><span style="font-size:12pt;"></span></b>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">一個很有意思的現象是,在</span><span style="font-size:12pt;">local_listener</span><span style="font-family:宋體;font-size:12pt;">的配置問題上,</span><span style="font-size:12pt;">MOS</span><span style="font-family:宋體;font-size:12pt;">和網路同仁們的差異是很大的。</span><span style="font-size:12pt;">MOS</span><span style="font-family:宋體;font-size:12pt;">官方意見是將監聽器別名設定上,而網路同仁們無一例外的選擇“括號表示式”。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">筆者實驗的情況是,直接設定監聽器別名,</span><span style="font-size:12pt;">Oracle</span><span style="font-family:宋體;font-size:12pt;">是不認可的。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">SQL> alter system set local_listener='my_listener' scope=both;</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">alter system set local_listener='my_listener' scope=both</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">*</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">ERROR at line 1:</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">ORA-02097: parameter cannot be modified because specified value is invalid</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">ORA-00119: invalid specification for system parameter LOCAL_LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">ORA-00132: syntax error or unresolved network name 'my_listener'</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;">Oracle</span><span style="font-family:宋體;font-size:12pt;">不能解析</span><span style="font-size:12pt;">my_listener</span><span style="font-family:宋體;font-size:12pt;">名稱,因為其既不是括號表示式,也不是設定的別名。這裡面就比較奇怪,我們分明已經在</span><span style="font-size:12pt;">listener.ora</span><span style="font-family:宋體;font-size:12pt;">檔案中定義了名稱。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">對</span><span style="font-size:12pt;">00132</span><span style="font-family:宋體;font-size:12pt;">錯誤,</span><span style="font-size:12pt;">Oracle</span><span style="font-family:宋體;font-size:12pt;">官方的解釋如下:</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">[oracle@aaalife admin]$ oerr ora 00132</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">00132, 00000, "syntax error or unresolved network name '%s'"</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">// *Cause:<span> </span>Listener address has syntax error or cannot be resolved.</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">// *Action: If a network name is specified, check that it corresponds</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">//<span> </span>to an entry in <span style="color:red;">TNSNAMES.ORA </span>or other address repository</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">//<span> </span>as configured for your system. Make sure that the entry</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">//<span> </span>is syntactically correct.</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;">Oracle</span><span style="font-family:宋體;font-size:12pt;">認為在伺服器端的</span><span style="font-size:12pt;">tnsnames.ora</span><span style="font-family:宋體;font-size:12pt;">檔案中,沒有能夠找到</span><span style="font-size:12pt;">my_listener</span><span style="font-family:宋體;font-size:12pt;">的對應名稱。</span><span style="font-size:12pt;">Tnsnames.ora</span><span style="font-family:宋體;font-size:12pt;">是我們儲存本地連線對應名稱的地方,這裡是否意味著說此處的別名,是一定在</span><span style="font-size:12pt;">tnsnames.ora</span><span style="font-family:宋體;font-size:12pt;">檔案中進行定義。本地命名別名定義我們是熟悉的。監聽器程式別名如何定義?</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">經過查詢</span><span style="font-size:12pt;">Oracle</span><span style="font-family:宋體;font-size:12pt;">早期文件和治療,從一個角落找到定義格式和方法。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">[oracle@aaalife admin]$ cat tnsnames.ora# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"># Generated by Oracle configuration tools.</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">MY_LISTENER=</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">(description=</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;"><span> </span>(address=(protocol=tcp)(host=AAALIFE)(port=1531)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">突發奇想,</span><span style="font-size:12pt;">tnsping</span><span style="font-family:宋體;font-size:12pt;">命令有解析格式的副作用。是否可以成功呢?</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">[oracle@aaalife admin]$ tnsping my_listener</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 20:43:58</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Copyright (c) 1997, 2013, Oracle.<span> </span>All rights reserved.</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Used parameter files:</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Used TNSNAMES adapter to resolve the alias</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Attempting to contact (description= (address=(protocol=tcp)(host=AAALIFE)(port=1531)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">OK (0 msec)</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">解析成功,起碼格式上沒有大的問題。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">SQL> <span style="color:red;">alter system set local_listener='MY_LISTENER' scope=both;</span></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">System altered.</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">SQL> show parameter local;</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">NAME<span> </span>TYPE<span> </span>VALUE</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">------------------------------------ ----------- ------------------------------</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">local_listener<span> </span>string<span> </span>MY_LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">log_archive_local_first<span> </span>boolean<span> </span>TRUE</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">parallel_force_local<span> </span>boolean<span> </span>FALSE</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">啟動手工註冊,檢視監聽器狀態。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">SQL> alter system register;</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">System altered.</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">[oracle@aaalife admin]$<span style="color:red;"> lsnrctl status my_listener</span></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-SEP-2015 20:50:47</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Copyright (c) 1991, 2013, Oracle.<span> </span>All rights reserved.</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1531)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">STATUS of the LISTENER</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">------------------------</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Alias<span> </span>my_listener</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Version<span> </span>TNSLSNR for Linux: Version 11.2.0.4.0 - Production</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Start Date<span> </span>07-SEP-2015 19:48:50</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Uptime<span> </span>0 days 1 hr. 1 min. 59 sec</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Trace Level<span> </span>off</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Security<span> </span>ON: Local OS Authentication</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">SNMP<span> </span>OFF</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listener Parameter File<span> </span>/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listener Log File<span> </span>/u01/app/oracle/diag/tnslsnr/aaalife/my_listener/alert/log.xml</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Listening Endpoints Summary...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"><span> </span>(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1531)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"><span> </span>(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1531)))</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">Services Summary...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Service "aaadb" has 1 instance(s).</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;"><span> </span>Instance "aaadb", status READY, has 1 handler(s) for this service...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;">Service "aaadbXDB" has 1 instance(s).</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="color:red;font-size:12pt;"><span> </span>Instance "aaadb", status READY, has 1 handler(s) for this service...</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;">The command completed successfully</span>
</p>
<p style="text-indent:2em;background:#eeece1;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">設定成功,監聽器狀態中</span><span style="font-size:12pt;">my_listener</span><span style="font-family:宋體;font-size:12pt;">作為別名</span><span style="font-size:12pt;">alias</span><span style="font-family:宋體;font-size:12pt;">出現在狀態資訊中。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<b><span style="font-size:12pt;">4</span></b><b><span style="font-family:宋體;font-size:12pt;">、結論</span></b><b><span style="font-size:12pt;"></span></b>
</p>
<p style="text-indent:2em;">
<span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
<span style="font-family:宋體;font-size:12pt;">動態註冊是我們最常用的註冊模式。多個配置檔案(</span><span style="font-size:12pt;">Oracle Net Service</span><span style="font-family:宋體;font-size:12pt;">)、</span><span style="font-size:12pt;">Oracle</span><span style="font-family:宋體;font-size:12pt;">引數、監聽器設定交織相互作用影響,期間又有網路網路卡、域名解析等多因素作用,很容易出現問題故障。多實驗、多測試,可以幫助我們抽絲剝繭,逐步深入的瞭解系統,在日常工作中更加遊刃有餘。</span><span style="font-size:12pt;"></span>
</p>
<p style="text-indent:2em;">
</p>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28211342/viewspace-2153836/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle監聽【非1521埠】動態註冊Oracle
- Oracle 建立非1521埠監聽Oracle
- Oracle Listener 動態註冊 與 靜態註冊Oracle
- Oracle listener靜態註冊和動態註冊Oracle
- Oracle Listener 動態註冊與靜態註冊Oracle
- ORACLE 動態註冊,靜態註冊,多個監聽,一個監聽多個埠配置Oracle
- oracle監聽靜態註冊和動態註冊Oracle
- oracle監聽動態註冊與靜態註冊Oracle
- Oracle監聽的靜態註冊和動態註冊Oracle
- Oracle listener靜態註冊和動態註冊總結Oracle
- Oracle監聽的動態註冊與靜態註冊Oracle
- 【LISTENER】實現將資料庫例項同時動態註冊到兩個非預設監聽埠資料庫
- oracle監聽動態註冊與靜態註冊[轉帖]Oracle
- Oracle 動態監聽註冊Oracle
- oracle listener 靜態和動態註冊Oracle
- Wireshark分析非標準埠號流量
- 動態註冊和靜態註冊
- 靜態註冊和動態註冊
- WIN下動態註冊碼實現方法 (轉)
- oracle監聽器動態註冊於靜態註冊的區別Oracle
- 【監聽】動態註冊和靜態註冊
- Oracle10g中的靜態註冊及動態註冊問題Oracle
- JNI原始碼分析(並實現JNI動態註冊)原始碼
- Oracle動態監聽註冊測試Oracle
- 再說Oracle Listener動靜態註冊Oracle
- ORACLE的動態註冊行為 ztOracle
- oracle監聽之動態和靜態註冊Oracle
- 靜態註冊和動態註冊總結(zt)
- listener靜態註冊和動態註冊總結
- Oracle自動動態註冊成功的條件Oracle
- 實現Spring動態註冊多資料來源Spring
- oracle監聽器的靜態和動態註冊Oracle
- 【原創】Oracle的動態監聽註冊Oracle
- Banq,請教如何動態實現標準java bean?JavaBean
- listener的靜態註冊與動態註冊詳述
- Oracle監聽器的靜態註冊與動態註冊,以及DB_DOMAIN問題OracleAI
- vue動態註冊元件Vue元件
- 監聽動態註冊