Oracle Database - Listener

1 - About

When an database instance starts, it registers itself with a listener using one or more service names. When a client program or database connects to a listener, it requests a connection to a service.

A service name can identify multiple database instances, and an instance can belong to multiple services.

For this reason, the listener acts as a mediator between the client and instances and routes the connection request to the appropriate instance. Clients connecting to a service need not specify which instance they require.

To connect to a database service, clients first contact a listener process that typically resides on the database server. The listener receives incoming client connection requests and sends these requests to the database server. After the connection is established, the client and database server communicate directly.

The listener knows which services can handle connection requests because an Oracle database dynamically registers this information with the listener. This process of registration is called service registration. Registration also provides the listener with information about the database instances and the service handlers available for each instance.

3 - Listener in an connection request

When the listener receives the client request, it selects one of the registered service handlers. Depending on the type of handler selected, the communication protocol used, and the operating system of the database server, the listener performs one of the following actions:

  • Hands the connect request directly off to a disptacher.
  • Sends a redirect message back to the client with the location of the dispatcher or dedicated server process. The client then connects directly to the dispatcher or dedicated server process.
  • Spawns a dedicated server process and passes the client connection to the dedicated server process.

After the listener has completed the connection operation for the client, the client communicates directly with the Oracle database without the listener's involvement. The listener resumes listening for incoming network sessions.

The process in the 3 steps:

  • 1. The client sends a connection request to the listener.
  • 2. The listener parses the client request and forwards it to the service handler for the database service requested.
  • 3. The client connects to the database.

4 - Listener Management

4.1 - Configuration

A listener is configured with one or more listening protocol addresses, information about supported services, and parameters that control its run-time behavior. The listener configuration is stored in a configuration file named listener.ora.

To know more about the listener configuration, see this article: Oracle Database - Configuration of the Listener (listener.ora)

4.2 - Restart

  • Windows: Restart the listener service. Example : “OracleOraDb10g_home1TNSListener”

  • linux:
cd $ORACLE_HOME/bin
./lsnrclt stop
./lsnrclt start

4.3 - Useful Command

lsnrctl status
lsnrctl service

4.4 - Tracing and Logging

To set tracing parameters with Oracle Enterprise Manager and Oracle Net Manager:

4.4.1 - Oracle Net Manager

  1. Start Oracle Net Manager.
  2. In the navigator pane, expand Local > Profile.
  3. From the list in the right pane, select General.
  4. Click the Tracing tab.
  5. Specify the settings (see help for the setting)
  6. Choose File > Save Network Configuration.

This action add this line in the sqlnet.ora by example for the level admin : TRACE_LEVEL_SERVER = ADMIN

sqlnet.trc (for the client)
svr_pid.trc (for the server)

The default directory is ORACLE_HOME\network\trace.

4.4.2 - Oracle Enterprise Manager

  1. Access the Oracle Net Administration page in Oracle Enterprise Manager.
  2. Select Listeners from the Administer list, and then select the Oracle home that contains the location of the configuration files.
  3. Click Go. The Listeners page appears.
  4. Select a listener, and then click Edit. The Edit Listeners page appears.
  5. Click the Logging & Tracing tab.
  6. Specify the settings.
  7. Click OK.

listener.trc

5 - Support

5.1 - Log Directory

  • ORACLE_HOME\network\trace
  • ORACLE_HOME\network\log

6 - Documentation / Reference

db/oracle/listener.txt · Last modified: 2017/09/06 19:30 by gerardnico