没有listener.ora的听众收听

Gon*_*alo 7 oracle listener

我有一个 Oracle DB 在生产中工作了一年多。
我让我的听众工作:

[oracle@base admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0     
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                02-NOV-2016 14:22:38
Uptime                    1 days 20 hr. 3 min. 13 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /o/app/oracle/diag/tnslsnr/base/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=base)(PORT=1521)))
Services Summary...
Service "BASE" has 1 instance(s).
  Instance "BASE", status READY, has 1 handler(s) for this service...
Service "BASEXDB" has 1 instance(s).
  Instance "BASE", status READY, has 1 handler(s) for this service...
The command completed successfully
Run Code Online (Sandbox Code Playgroud)

我没有listener.ora

ls /o/app/oracle/product/DB_11.2_SE/dbhome_2/network/admin/
示例 shrept.lst tnsnames.ora

这是我的内容tnsnames.ora

$ cat tnsnames.ora 
基础 =
  (描述 =
    (ADDRESS_LIST =
      (地址 = (协议 = TCP)(主机 = 10.20.20.19)(端口 = 1521))
      (LOAD_BALANCE = 是)
    )
    (CONNECT_DATA =
      (SERVICE_NAME = 基础)
    )
  )


ORCL =
  (描述 =
    (地址 = (协议 = TCP)(主机 = 10.20.20.20)(端口 = 1522))
    (CONNECT_DATA =
      (服务器 = 专用)
      (SERVICE_NAME = orcl)
    )
  )

这怎么可能?据我所知,要让听众工作,我必须有一个listener.ora文件。

我安装了另一个 Oracle 数据库,如果我执行lsnrctl status,在输出中我可以看到一行包含Listener Parameter File /o/app/oracle/product/11.2/dbhome/network/admin/listener.ora,但我在这里没有看到它。我也执行了locate listener.ora,什么也没执行。

Phi*_*lᵀᴹ 6

你不需要一个listener.ora. 侦听器会很乐意在没有任何服务的情况下开始,但会在不支持任何服务的情况下开始。pmon将定期向侦听器注册数据库,但您可以手动强制注册。

将文件移开:

C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN>move listener.ora listener.foo
    1 file(s) moved.
Run Code Online (Sandbox Code Playgroud)

启动监听器:

C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN>lsnrctl start

LSNRCTL for 64-bit Windows: Version 11.2.0.2.0 - Production on 04-NOV-2016 13:50
:03

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Starting tnslsnr: please wait...

TNSLSNR for 64-bit Windows: Version 11.2.0.2.0 - Production
Log messages written to C:\oraclexe\app\oracle\diag\tnslsnr\host\listener\alert\log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 64-bit Windows: Version 11.2.0.2.0 - Produ
ction
Start Date                04-NOV-2016 13:50:08
Uptime                    0 days 0 hr. 0 min. 5 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         C:\oraclexe\app\oracle\diag\tnslsnr\host\listener\alert\log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host)(PORT=1521)))
The listener supports no services
The command completed successfully
Run Code Online (Sandbox Code Playgroud)

使用监听器注册数据库:

C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN>sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Fri Nov 4 13:50:38 2016

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


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> alter system register;

System altered.

SQL>
Run Code Online (Sandbox Code Playgroud)

监听器现在支持数据库:

C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN>lsnrctl status

LSNRCTL for 64-bit Windows: Version 11.2.0.2.0 - Production on 04-NOV-2016 13:51
:20

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 64-bit Windows: Version 11.2.0.2.0 - Produ
ction
Start Date                04-NOV-2016 13:50:08
Uptime                    0 days 0 hr. 1 min. 15 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         C:\oraclexe\app\oracle\diag\tnslsnr\host\list  ener\alert\log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host)(PORT=8080))(Presentation=HTTP)(Session=RAW))
Services Summary...
Service "XEXDB" has 1 instance(s).
  Instance "xe", status READY, has 1 handler(s) for this service...
Service "xe" has 1 instance(s).
  Instance "xe", status READY, has 1 handler(s) for this service...
The command completed successfully

C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN>
Run Code Online (Sandbox Code Playgroud)


Bal*_*app 4

“据我所知,为了使侦听器正常工作,我必须拥有listener.ora 文件。”

从 8.1.5 开始,listener.ora 对于默认侦听器是可选的。

在没有 LISTENER.ORA 的情况下启动监听器(文档 ID 208968.1)

目的

为了宣传这一事实,从 Oracle8i (8.1.5) 开始,不再需要 LISTENER.ORA 来启动默认 Oracle Net Listener。