Oracle Net Listener
是一个独立的进程,负责处理client
的请求,并把这些请求分发给相应的database instance
。配置文件是listener.ora
,位于$ORACLE_HOME/network/admin
目录下。修改这个文件必须重启listener
进程。
listener.ora
如下所示:
# listener.ora Network Configuration File: /u01/app/oracle/product/12.1.0/dbhome_1/network/admin/lis
tener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = db01)
(ORACLE_HOME = /u01/app/oracle/product/11.1.0/db_1)
(SID_NAME = db01)
)
(SID_DESC =
(GLOBAL_DBNAME = dev12c)
(ORACLE_HOME = /u01/app/oracle/product/12.1.0/dbhome_1)
(SID_NAME = dev12c)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = orasvr01)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER
部分指定listener
进程需要处理的数据库连接;而LISTENER
部分指定这些数据库所在的主机,以及listener
进程需要监听的端口。
在数据库能够服务客户端请求之前,必须要启动listener
进程。使用lsnrctl
命令可以启动和停止listener
进程:
$ lsnrctl start
$ lsnrctl stop
lsnrctl status
命令可以用来检查listener
的状态。
$ lsnrctl status
LSNRCTL for Linux: Version 12.1.0.2.0 - Production on 16-FEB-2016 04:55:25
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=npar1.atc-hp.com)(PORT=9012)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.2.0 - Production
Start Date 04-FEB-2016 01:01:06
Uptime 12 days 3 hr. 54 min. 18 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /app/oracle/product/12.1.0/dbhome_1/network/admin/listener.ora
Listener Log File /app/oracle/diag/tnslsnr/npar1/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=npar1.atc-hp.com)(PORT=9012)))
Services Summary...
Service "ORCL2" has 1 instance(s).
Instance "ORCL2", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
参考资料:
Configuring and Administering Oracle Net Listener;
How to Configure the Database Listener with Listener.ora in Oracle 12c。