Databases 16 min read

Mastering Oracle Listener: Functions, Commands, and Registration Explained

This article provides a comprehensive guide to Oracle Listener, covering its core functions, how to operate it via lsnrctl commands on Windows, detailed configuration of listener.ora for static and dynamic registration, and best practices for ensuring high availability and load balancing.

ITPUB
ITPUB
ITPUB
Mastering Oracle Listener: Functions, Commands, and Registration Explained

Oracle Listener is a critical component of the Oracle database architecture, acting as the bridge between client requests and database server processes.

Listener Functions

Listen for client connection requests on the default port 1521, running as a dedicated process (TNSLSNR on Windows, lsnrctl on Unix).

Allocate a Server Process for each request, handing the connection off to an Oracle Server Process that actually executes SQL.

Register instance services by communicating instance names and service names to the listener, supporting both static and dynamic registration.

Provide failover capabilities for RAC environments, automatically redirecting client requests when a database instance crashes.

Perform load balancing by directing new connections to less‑loaded instances based on connection counts.

Operating the Listener

The listener can be managed directly from the command line using the lsnrctl utility. Below is a typical Windows session.

C:\Documents and Settings\Administrator>lsnrctl
LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 26-12月-2010 21:5
Copyright (c) 1991, 2005, Oracle.  All rights reserved.
欢迎来到LSNRCTL, 请键入"help"以获得信息。
LSNRCTL>

Check Listener Status

Enter status to view the current state, registered services, and configuration files.

LSNRCTL> status
//连接监听器的名称和信息:主机名+监听端口号
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=www-0e6111dff74)(PORT=1521)))
LISTENER 的 STATUS
------------------------
别名               LISTENER
版本               TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 – Production
启动日期           26-12月-2010 19:38:03
正常运行时间       0 天 2 小时 23 分 51 秒
跟踪级别           off
安全性             ON: Local OS Authentication
SNMP                OFF
监听程序参数文件   D:\oracle
etwork\admin\listener.ora
监听程序日志文件   D:\oracle
etwork\log\listener.log
服务 "orcl" 包含 1 个例程。
例程 "orcl", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功

Start and Stop the Listener

Use stop and start to control the listener. Example output is shown below.

LSNRCTL> stop
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=www-0e6111dff74)(PORT=1521)))
命令执行成功

LSNRCTL> start
启动tnslsnr: 请稍候...
TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Production
系统参数文件为 D:\oracle
etwork\admin\listener.ora
写入 D:\oracle
etwork\log\listener.log 的日志信息
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=www-0e6111dff74)(PORT=1521)))
...

Listener Configuration Files

The listener relies on listener.ora, a plain‑text file that defines ports, host names, and registration information. Two registration modes exist:

Static registration : Explicitly lists services and instance names in the file.

Dynamic registration : The instance’s PMON process periodically registers its service_name and instance_name with the listener.

Typical static configuration example:

# listener.ora Network Configuration File: D:\oracle\product\10.2.0\db_1
etwork\admin\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
 (SID_LIST =
  (SID_DESC =
   (SID_NAME = PLSExtProc)
   (ORACLE_HOME = D:\oracle)
   (PROGRAM = extproc)
  )
  (SID_DESC =
   (GLOBAL_DBNAME = orcl)
   (ORACLE_HOME = D:\oracle)
   (SID_NAME = orcl)
  )
 )
LISTENER =
 (DESCRIPTION_LIST =
  (DESCRIPTION =
   (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
   (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
  )
 )

Dynamic registration does not require explicit entries; the instance automatically informs the listener. The parameters instance_name and service_names can be viewed with SQL*Plus:

SQL> show parameter instance_name;
instance_name = orcl
SQL> show parameter service_names;
service_names = orcl

If these parameters are not set, Oracle derives defaults, but explicit settings improve registration reliability.

Forcing Immediate Registration

Administrators can trigger an immediate registration using:

SQL> alter system register;
System altered

Key Takeaways

The listener mediates client connections, allocating server processes and handling failover.

Static registration is defined in listener.ora; dynamic registration is automatic via PMON.

Proper start/stop commands and configuration ensure high availability, load balancing, and correct service discovery.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

databaseConfigurationOraclelistenerRAC
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.