溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何監(jiān)聽Oracle

發(fā)布時(shí)間:2021-12-01 17:18:42 來源:億速云 閱讀:289 作者:小新 欄目:關(guān)系型數(shù)據(jù)庫

這篇文章將為大家詳細(xì)講解有關(guān)如何監(jiān)聽Oracle,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

Oracle 監(jiān)聽

一:沒有l(wèi)istener.ora監(jiān)聽文件


監(jiān)聽文件listener.ora文件丟失;
沒有l(wèi)istener.ora文件情況時(shí),以默認(rèn)方式運(yùn)行監(jiān)聽器,此時(shí),監(jiān)聽器將在解析為計(jì)算機(jī)主機(jī)名(端口1521)的任何地址上進(jìn)行監(jiān)聽;
建議始終配置listener.ora文件,使Oracle Net環(huán)境可以自我記錄;

[oracle@chen admin]$ pwd
/u01/app/oracle/product/11.2.0.4/network/admin

[oracle@chen admin]$ ls
samples  shrept.lst  tnsnames.ora

沒有配置listener.ora時(shí),自動(dòng)使用動(dòng)態(tài)注冊
[oracle@chen admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 20-JUL-2017 15:05:25
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-JUL-2017 15:03:54
Uptime                    0 days 0 hr. 1 min. 30 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /u01/app/oracle/diag/tnslsnr/chen/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=chen)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

二:監(jiān)聽靜態(tài)注冊


[oracle@chen admin]$ pwd
/u01/app/oracle/product/11.2.0.4/network/admin

[oracle@chen admin]$ cat listener.ora 
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = orcl)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0.4)
      (SID_NAME = orcl)
    )
  )

靜態(tài)注冊時(shí):
可以遠(yuǎn)程啟動(dòng)數(shù)據(jù)庫(需要有口令文件);

C:\Users\Administrator>sqlplus sys/oracle@10.1.233.100:1521/orcl as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on 星期四 7月 20 13:33:09 2017

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

已連接到空閑例程。

SQL> startup
ORACLE 例程已經(jīng)啟動(dòng)。

Total System Global Area  839282688 bytes
Fixed Size                  2257880 bytes
Variable Size             545262632 bytes
Database Buffers          289406976 bytes
Redo Buffers                2355200 bytes
數(shù)據(jù)庫裝載完畢。
數(shù)據(jù)庫已經(jīng)打開。  [oracle@chen admin]$ lsnrctl status
.....
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=chen)(PORT=1521)))
Services Summary...
Service "orcl" has 2 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

配置DG,EM等建議使用靜態(tài)注冊

三:監(jiān)聽動(dòng)態(tài)注冊


[oracle@chen admin]$ cat listener.ora 
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = chen)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )
  
SQL> alter system register;
System altered.

[oracle@chen admin]$ lsnrctl status
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

實(shí)例未啟動(dòng)時(shí),注冊不了服務(wù)
Services Summary...
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=chen)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully

動(dòng)態(tài)注冊時(shí)無法遠(yuǎn)程啟動(dòng)數(shù)據(jù)庫
C:\Users\Administrator>sqlplus sys/oracle@10.1.233.100:1521/orcl as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on 星期四 7月 20 14:26:57 2017

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

ERROR:
ORA-12514: TNS: 監(jiān)聽程序當(dāng)前無法識(shí)別連接描述符中請求的服務(wù)

請輸入用戶名:

四:監(jiān)聽動(dòng)態(tài)注冊+靜態(tài)注冊


[oracle@chen admin]$ cat listener.ora 
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = orcl)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0.4)
      (SID_NAME = orcl)
    )
  )
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = chen)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

[oracle@chen admin]$ lsnrctl status
......  
Services Summary...
Service "orcl" has 2 instance(s).
  Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully

可以遠(yuǎn)程啟動(dòng)數(shù)據(jù)庫
C:\Users\Administrator>sqlplus sys/oracle@10.1.233.100:1521/orcl as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on 星期四 7月 20 14:22:59 2017

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

已連接到空閑例程。

SQL> startup
ORACLE 例程已經(jīng)啟動(dòng)。

Total System Global Area  839282688 bytes
Fixed Size                  2257880 bytes
Variable Size             545262632 bytes
Database Buffers          289406976 bytes
Redo Buffers                2355200 bytes
數(shù)據(jù)庫裝載完畢。
數(shù)據(jù)庫已經(jīng)打開。官方文檔位置如下:
Oracle Database Net Services Reference
http://docs.oracle.com/cd/E11882_01/network.112/e10835/listener.htm#NETRF008
Oracle Net Listener Parameters (listener.ora)
http://docs.oracle.com/cd/E11882_01/network.112/e10835/listener.htm#NETRF008

關(guān)于“如何監(jiān)聽Oracle”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請把它分享出去讓更多的人看到。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI