10Configuring and Administering Oracle Net Listener

Oracle Net Listener is a separate process that runs on the database server computer. It receives incoming client connection requests and manages the traffic of these requests to the database server. This chapter describes how to configure the listener to accept client connections.

10.1Oracle Net Listener Configuration Overview

Note:

The version of the listener must be the same as or higher than the highest version of all Oracle databases being serviced through the listener.

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.

Because all of the configuration parameters have default values, it is possible to start and use a listener with no configuration. This default listener has a name of LISTENER, supports no services on startup, and listens on the following TCP/IP protocol address:

(ADDRESS=(PROTOCOL=tcp)(HOST=host_name)(PORT=1521))

Supported services, that is, the services to which the listener forwards client requests, can be configured in the listener.ora file or this information can be dynamically registered with the listener. This dynamic registration feature is called service registration. The registration is performed by the PMON process—an instance background process—of each database instance that has the necessary configuration in the database initialization parameter file. Dynamic service registration does not require any configuration in the listener.ora file.

Service registration reduces the need for the SID_LIST_listener_name parameter setting, which specifies information about the databases served by the listener, in the listener.ora file.

Note:

The SID_LIST_listener_name parameter is still required if you are using Oracle Enterprise Manager to manage the database.

Connect-time failover

Because the listener always monitors the state of the instances, service registration facilitates automatic failover of the client connect request to a different instance if one instance is down.

In a static configuration model, a listener starts a dedicated server when it receives a client request. If the instance is not up, the server will return an "Oracle not available" error message.

Connection load balancing

Service registration enables the listener to forward client connect requests to the least-loaded instance and dispatcher or dedicated server. Service registration balances the load across the service handlers and nodes.

During an Enterprise Edition or Standard Edition installation on the database server, Oracle Net Configuration Assistant automatically configures a listener with a name of LISTENER that has a TCP/IP listening protocol address for Oracle Database. During a Custom installation, Oracle Net Configuration Assistant prompts you to configure a listener name and a protocol address of your choice.

Oracle Net Configuration Assistant also automatically configures service information for the external procedures in the listener.ora file.

Example 10-1 shows a sample listener.ora file. The LISTENER entry defines the listening protocol address for a listener named LISTENER, and the SID_LIST_LISTENER entry provides information about the services statically supported by the listener LISTENER.

If you are using the IPC protocol, you can improve performance by specifying the maximum number of concurrent IPC connection requests to match your expected connection requests. In listener.ora for example, you can specify the value as in the following example:

10.3.1Configuring Listening Protocol Addresses

Select Listeners from the Administer list, and then select the Oracle home that contains the location of the configuration files.

Click Go.

The Listeners page appears.

Select a listener, and then click Edit.

The Edit Listener page appears.

In the Addresses section, configure protocol support:

Click Add.

The Add Address page appears.

From the Protocol list, select the protocol on which the listener is configured to listen.

Enter the appropriate parameter information for the selected protocol in the fields provided.

When configuring the listener to listen on TCP/IP, you should enter the default port of 1521. If you do not, you must configure the LOCAL_LISTENER parameter in the initialization parameter file and resolve the listener name through a naming method.

If the computer has more than one IP address and you want the listener to listen on all available IP addresses, configure TCP/IP or TCP/IP with SSL and enter the host name of the computer in the Host field.

Optionally, in the Advanced Parameters section, specify the I/O buffer space limit for send and receive operations of sessions in the Total Send Buffer Size and Total Receive Buffer Size fields.

You can also configure additional listening addresses with Oracle Net Manager. See the online Help for further instruction.

10.3.2Handling Large Volumes of Concurrent Connection Requests

If you expect the listener to handle large volumes of concurrent connection requests, then you can specify a listener queue size for its TCP/IP or IPC listening endpoints. To specify the listener queue size, specify the QUEUESIZE parameter at the end of the protocol address with its value set to the expected number of concurrent requests, similar to Example 10-2.

The default number of concurrent connection requests is operating system-specific. The defaults for TCP/IP on the Solaris Operating System and Windows follow:

Solaris Operating System: 5

Windows XP Professional SP2: 10

Windows 2003 Server Enterprise Edition: 200

10.3.3Configuring Static Service Information

The listener uses the dynamic service information about the database and instance it has received through service registration before using statically configured information in the listener.ora file.

Static configuration is also required for other services, such as external procedures, Heterogeneous Services.

Table 10-1 describes static service settings that you can set in the listener.ora file.

Table 10-1 Static Service Settings in listener.ora

Oracle Net Manager Field

listener.ora File Parameter

Description

SID

SID_NAME

Specifies the Oracle System Identifier (SID) of the instance. You can obtain the SID value from the INSTANCE_NAME parameter in the initialization parameter file.

Service Name

GLOBAL_DBNAME

Identifies the database service.

While processing a client connection request, the listener tries to match the value of this parameter with the value of the SERVICE_NAME parameter in the client connect descriptor. If the client connect descriptor uses the SID parameter, then the listener does not attempt to map the values. This parameter is primarily intended for configurations with Oracle8 release 8.0 databases (where dynamic service registration is not supported for dedicated servers). This parameter may also be required for use with Oracle8i and higher database services by some configurations.

The value for this parameter is typically obtained from the combination of the DB_NAME and DB_DOMAIN parameters (DB_NAME.DB_DOMAIN) in the initialization parameter file, but the value can also contain any valid name used by clients to identify the service.

Oracle Home Directory

ORACLE_HOME

On UNIX, this setting is optional. Use it to specify the Oracle home location of the instance. Without this setting, the listener assumes its Oracle home for the instance.

On Windows, this setting is ignored. The Oracle home specified by the ORACLE_HOME parameter in HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\HOMEID of the Windows registry is used.

10.3.4Default Oracle Net Listener Administration

By default, Oracle Net Listener permits only local administration for security reasons. Additionally, as a policy, the listener can be administered only by the user who started it and this is enforced through local operating system authentication. So, if user1 starts the listener, only user1 can administer it, and any other user trying to administer it would get an error. The superuser is the only exception.

Oracle recommends that only local administration be allowed for the listener. However, in case a user wants to administer the listener remotely or a different user must administer the listener, either COST parameters or passwords can be used.

10.3.4.1Using COST Parameters and Other Secure Transports

The security of a particular transport depends on the characteristics of the network on which it is used. If you are administering the listener remotely over an insecure network and require maximum security, you can configure the listener with a secure protocol address that uses the TCP/IP with SSL protocol. If the listener has multiple protocol addresses, ensure that the TCP/IP with SSL protocol address is listed first in the listener.ora file.

The class of secure transports (COST) parameters provide a way to specify the list of transports that are considered secure and can be used for listener administration. Using the COST parameters does not affect any connections other than registration and control.

The COST parameters identify two conditions: which transports are considered secure for that installation and whether the administration of a that listener requires secure transports.

10.3.4.2Configuring Passwords for Oracle Net Listener

Oracle Net Listener Control (lsnrctl) is the command-line utility for managing Oracle Net Listener configuration, including passwords. A password can be configured for the listener to provide security for listener administrative operations, such as starting or stopping the listener, viewing a list of supported services, or saving changes to the Listener Control configuration. However, as mentioned earlier, local administration of the listener is secure by default through the local operating system. Therefore configuring a password is neither required nor recommended for secure local administration.

10.3.4.3Changing the Oracle Net Listener Password

To change the listener password, use the Listener Control utility's CHANGE_PASSWORD command or Oracle Enterprise Manager to set or modify an encrypted password in the PASSWORDS_listener_name parameter in the listener.ora file. If the PASSWORDS_listener_name parameter is set to an unencrypted password, you must manually remove it from the listener.ora file prior to modifying it. If the unencrypted password is not removed, you will be unable to successfully set an encrypted password.

To set or modify an encrypted password with Oracle Enterprise Manager:

10.4Configuring Service Registration

Service registration allows processes, such as an Oracle database, to identify their available services to the listener, which then acts as a portmapper for those services. The listener uses the dynamic service information about the database and instance it has received through service registration before using statically configured information in the listener.ora file. The listener uses the dynamic service information about the database and instance it has received through service registration before using statically configured information in the listener.ora file.

Dynamic service registration is configured in the database initialization file. It does not require any configuration in the listener.ora file. However, listener configuration must be synchronized with the information in the database initialization file.

This section contains the following configuration topics related to service registration:

10.4.1Configuring Service Registration

To ensure service registration works properly, the initialization parameter file should contain the following parameters:

SERVICE_NAMES for the database service name

INSTANCE_NAME for the instance name

For example:

SERVICE_NAMES=sales.us.example.com
INSTANCE_NAME=sales

The value for the SERVICE_NAMES parameter defaults to the global database name, a name comprising the DB_NAME and DB_DOMAIN parameters in the initialization parameter file, entered during installation or database creation. The value for the INSTANCE_NAME parameter defaults to the SID entered during installation or database creation.

10.4.2 Registering Information with a Local Listener

As explained in "Oracle Net Listener Configuration Overview", the default local listener is named LISTENER and listens using TCP/IP on port 1521. You can register information using the default or with a nondefault local listener.

10.4.2.1Registering Information with the Default Local Listener

By default, the PMON process registers service information with its local listener on the default local address of TCP/IP, port 1521. As long as the listener configuration is synchronized with the database configuration, PMON can register service information with a nondefault local listener or a remote listener on another node. Synchronization is simply a matter of specifying the protocol address of the listener in the listener.ora file and the location of the listener in the initialization parameter file.

10.4.2.2Registering Information with a Nondefault Local Listener

If you want PMON to register with a local listener that does not use TCP/IP, port 1521, then configure the LOCAL_LISTENER parameter in the initialization parameter file to locate the local listener.

For a shared server environment, you can alternatively use the LISTENER attribute of the DISPATCHERS parameter in the initialization parameter file to register the dispatchers with a nondefault local listener. Because both the LOCAL_LISTENER parameter and the LISTENER attribute enable PMON to register dispatcher information with the listener, it is not necessary to specify both the parameter and the attribute if the listener values are the same.

Set the LOCAL_LISTENER parameter as follows:

LOCAL_LISTENER=listener_alias

Set the LISTENER attribute as follows:

DISPATCHERS="(PROTOCOL=tcp)(LISTENER=listener_alias)"

listener_alias is then resolved to the listener protocol addresses through a naming method, such as a tnsnames.ora file on the database server.

For example, if the listener is configured to listen on port 1421 rather than port 1521, you can set the LOCAL_LISTENER parameter in the initialization parameter file as follows:

LOCAL_LISTENER=listener1

Using the same listener example, you can set the LISTENER attribute as follows:

10.4.3Registering Information with a Remote Listener

A remote listener is a listener residing on one computer that redirects connections to a database instance on another computer. Remote listeners are typically used in an Oracle Real Application Clusters (Oracle RAC) environment. You can configure registration to remote listeners, such as in the case of Oracle RAC, for dedicated server or shared server environments.

10.4.3.1 Registering Information with a Remote Listener in a Dedicated Server Environment

In a dedicated server environment, you must enable the PMON background process to register with a remote listener. You achieve this goal by configuring the REMOTE_LISTENER parameter in the initialization parameter file. The syntax of the REMOTE_LISTENER initialization parameter is as follows:

REMOTE_LISTENER=listener_alias

listener_alias is resolved to the listener protocol addresses through a naming method such as a tnsnames.ora file on the database host.

To dynamically update the REMOTE_LISTENER initialization parameter, use the SQL statement ALTER SYSTEM SET. If you set the parameter to null with the statement that follows, then PMON de-registers information with the remote listener with which it had previously registered information, as in the following example:

To register information with a remote listener in a dedicated server environment:

On the host where the remote listener resides, configure the listener.ora file with the protocol addresses of the remote listener.

For example, assume that a remote listener listens on port 1521 on host sales2-server.

On the database to which you want requests to be redirected, set the REMOTE_LISTENER parameter in the database initialization parameter file to the alias of the remote listener.

For example, suppose that a database resides on host sales1-server. To redirect requests to the database on sales1-server, you can set the REMOTE_LISTENER parameter in the initialization file for the database on host sales1-server as follows:

REMOTE_LISTENER=listener_sales2

Resolve the listener name alias for the REMOTE_LISTENER setting through a tnsnames.ora file on the database host.

For example, in the tnsnames.ora on sales1-server, you can resolve the remote listener alias listener_sales2 as follows:

10.4.3.2 Registering Information with a Remote Listener in a Shared Server Environment

In a shared server environment, you can use the same registration technique as for a dedicated server environment. Alternatively, you can set the LISTENER attribute of the DISPATCHERS parameter in the initialization parameter file to register the dispatchers with any listener.

The LISTENER attribute overrides the REMOTE_LISTENER parameter. Because the REMOTE_LISTENER parameter and the LISTENER attribute enable PMON to register dispatcher information with the listener, you need not specify both the parameter and the attribute if the listener values are the same.

The syntax of the LISTENER attribute is as follows:

DISPATCHERS="(PROTOCOL=tcp)(LISTENER=listener_alias)"

To register information with a remote listener in a shared server environment:

On the host where the remote listener resides, configure the listener.ora file with the protocol addresses of the remote listener.

For example, assume that a remote listener listens on port 1521 on host sales2-server.

On the database to which you want requests to be redirected, configure the LISTENER attribute of the DISPATCHERS parameter.

For example, suppose that a database resides on host sales1-server. To redirect requests to the database on sales1-server, set the DISPATCHER parameter in the initialization file for the database on host sales1-server as follows:

DISPATCHERS="(PROTOCOL=tcp)(LISTENER=listeners_sales2)"

Resolve the listener name alias for the LISTENER attribute through a tnsnames.ora file on the database host.

For example, in the tnsnames.ora on sales1-server, you can resolve the remote listener alias listener_sales2 as follows:

10.4.4Configuring a Naming Method

The listener name alias specified for the LOCAL_LISTENER parameter, REMOTE_LISTENER parameter, or LISTENER attribute can be resolved through a tnsnames.ora file.

A net service name entry should be created for the protocol address without the CONNECT_DATA section of the connect descriptor. Oracle Enterprise Manager and Oracle Net Manager does not enable you to configure a tnsnames.ora file without the CONNECT_DATA information. Therefore, Oracle recommends that you manually modify the tnsnames.ora file.

For example, if LOCAL_LISTENER is set to listener1 and listener1 uses TCP/IP on port 1421, then the entry in the tnsnames.ora file would be:

listener1=
(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)(PORT=1421))

Note:

Multiple addresses are supported, but connect-time failover and client load balancing features are not supported.

10.5Listener Administration

Once the listener is configured, the listener can be administered with the Listener Control utility or Oracle Enterprise Manager. This section describes some of the common administrative tasks for the listener, including the following topics:

Select Listeners from the Administer list, and then select the Oracle home that contains the location of the configuration files.

Click Go.

The Listeners page appears.

Select a listener.

From the Actions list, select Start/Stop.

The Start/Stop page appears.

Depending upon the current status of the selected listener, the operation will be either Stop or Start. Click OK to perform the operation.

10.5.2Determining the Current Status of a Listener

To show the current status of a listener, use either the STATUS command of the Listener Control utility or Oracle Enterprise Manager. The status output provides basic status information about a listener, a summary of listener configuration settings, the listening protocol addresses, and a summary of services registered with the listener.

Using the Listener Control Utility to Determine the Listener Status

The STATUS command provides basic status information about a listener, including a summary of listener configuration settings, the listening protocol addresses, and a summary of services registered with the listener.

To show the status the listener from the command line, enter:

lsnrctl STATUS [listener_name]

where listener_name is the name of the listener defined in the listener.ora file. It is not necessary to identify the listener if you are using the default listener, named LISTENER.

This output shows that two database services, sales.us.example.com and hr.us.example.com, are registered with the listener.

Client connection requests to sales.us.example.com are handled by two dispatchers named D000 and D001 and one dedicated server. All handlers have a status of ready, indicating that they are ready to receive connections.

Client connection requests to hr.us.example.com are handled by one dispatcher named D001 and one dedicated server.

10.5.4Monitoring Listener Log Files

When you notice any of the following conditions, review and monitor the listener log file for the following:

Long connection establishment times

Connectivity problems and refusals

Unexpected shutdown of the listener that could indicate a denial-of-service attack