- 9 Configuring and Administering Oracle Net Listener
- Overview of Oracle Net Listener
- Configuring Dynamic Service Registration
- Setting Initialization Parameters for Service Registration
- Registering Information with a Local Listener
- Registering Information with a Remote Listener
- Registering Information with All Listeners in a Network
- Configuring a Naming Method
- Configuring Oracle Net Listener During Installation
- Customizing Oracle Net Listener Configuration
- Configuring Listening Protocol Addresses
- Configuring Listening Protocol Addresses Using Oracle Enterprise Manager Cloud Control
- Configuring Listening Protocol Addresses Using Oracle Net Manager
- Handling Large Volumes of Concurrent Connection Requests
- Managing Oracle Net Listener Security
- Specifying Valid Nodes and Subnets
- Administering the Listener
- Starting and Stopping a Listener
- Starting or Stopping a Listener Using the Listener Control Utility
- Starting or Stopping a Listener Using Oracle Enterprise Manager Cloud Control
- Managing a Listener in an Oracle Restart Configuration
- Viewing Configured Listeners Using the SRVCTL Utility
- Adding or Removing a Listener Using the SRVCTL Utility
- Starting or Stopping a Listener Using the SRVCTL Utility
- Determining the Current Status of a Listener
- Showing Status Using Listener Control
- Showing Status Using Oracle Enterprise Manager Cloud Control
- Monitoring Services of a Listener
- Monitoring Listener Log Files
9 Configuring and Administering Oracle Net Listener
Oracle Net Listener is a separate process that runs on the database server. 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.
This chapter contains the following topics:
In Oracle Database 12 c Release 1 (12.1), the listener password feature is no longer supported. This does not cause a loss of security because authentication is enforced through local operating system authentication. Refer to Oracle Database Net Services Reference for additional information.
Chapter 2, «Identifying and Accessing the Database» for a description of how the listener is used during an initial connection request
Overview of Oracle Net Listener
The release of the listener must be the same as or later than the latest release 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 runtime behavior. The listener configuration is stored in a configuration file named listener.ora .
Because 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:
The listener forwards client requests to supported services. These services are dynamically registered with the listener. This dynamic registration feature is called service registration . The registration is performed by the Listener Registration (LREG) process. Dynamic service registration does not require any manual configuration in the listener.ora file.
Service registration offers the following benefits:
Because the listener always monitors the state of the instances, service registration facilitates automatic failover of a client connect request to a different instance if one instance is down.
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 handler s and nodes.
High-availability for Oracle Real Application Clusters and Oracle Data Guard
Configuring Dynamic Service Registration
Service registration allows processes, such as an Oracle database, to identify their available services to the listener, which then acts as a port mapper for those services. The listener uses the dynamic service information about the database and instance received through service registration.
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 set to listen on the ports named in the database initialization file, and must not have parameters set that prevent automatic registration, such as COST parameters.
This section contains the following configuration topics related to service registration:
Setting Initialization Parameters for 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
LOCAL_LISTENER for the local listener
REMOTE_LISTENER for the remote listener, if any
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. The value for the INSTANCE_NAME parameter defaults to the Oracle system identifier (SID).
Oracle Database Reference for additional information about the SERVICE_NAMES and INSTANCE_NAME parameters
Registering Information with a Local Listener
By default, the LREG process registers service information with its local listener on the default local address of TCP/IP, port 1521. If the listener configuration is synchronized with the database configuration, then LREG can register service information with a nondefault local listener or a remote listener on another node. Synchronization occurs when the protocol address of the listener is specified in the listener.ora file and the location of the listener is specified in the initialization parameter file.
To have the LREG process register with a local listener that does not use TCP/IP, port 1521, configure the LOCAL_LISTENER parameter in the initialization parameter file to locate the local listener.
For a shared server environment, you can use the LISTENER attribute of the DISPATCHERS parameter in the initialization parameter file to register the dispatchers with a nondefault local listener. Because the LOCAL_LISTENER parameter and the LISTENER attribute enable LREG 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.
LOCAL_LISTENER is a comma-delimited list parameter. If a comma appears in the string, then the entire string must be enclosed in double quotation marks. Set the LOCAL_LISTENER parameter as follows:
For example, if the listener address «ab,cd» is entered, then it resolves to one listener address. If the address is entered as ab,cd , then it resolves to two listener addresses, ab and cd .
For shared server connections, set the LISTENER attribute as follows:
In the preceding command, listener_address is resolved to the listener protocol addresses through a naming method, such as a tnsnames.ora file on the database server.
To dynamically update the LOCAL_LISTENER parameter, use the SQL statement ALTER SYSTEM as follows:
If you set the parameter to null using the following statement, then the default local address of TCP/IP, port 1521 is assumed:
The LISTENER attribute overrides the LOCAL_LISTENER parameter. As a result, the SQL statement ALTER SYSTEM SET LOCAL_LISTENER does not affect the setting of this attribute.
In Example 9-1, a database resides on host sales1-server . The listener on this host is named listener_sales1 and is configured to listen on port 1421 instead of port 1521.
Example 9-1 Registering a Local Listener in a Dedicated Server Environment
On the host where the local listener resides, configure the listener.ora file with the protocol address of the listener using Oracle Net Manager.
On the database, set the LOCAL_LISTENER parameter in the database initialization parameter file to the alias of the local listener. For example:
If the database is configured for shared server connections, then you could set the LISTENER attribute as follows:
Resolve the listener name alias for the LOCAL_LISTENER setting through a tnsnames.ora file on the database host using a text editor, as follows:
If you are registering a local listener and use Oracle Connection Manager, then do not include (DESCRIPTION = or its closing parenthesis.
A network service name entry can be created for the protocol address without the CONNECT_DATA section of the connect descriptor.
See Oracle Database SQL Reference for additional information about the ALTER SYSTEM statement.
Registering 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 with Oracle RAC, for dedicated or shared server environments.
In a dedicated server environment, you must enable the LREG background process to register with a remote listener. You do this by configuring the REMOTE_LISTENER parameter, which is a comma-delimited list parameter, in the initialization parameter file. The syntax of REMOTE_LISTENER is as follows:
In the preceding command, listener_address is resolved to the listener protocol addresses through a naming method such as a tnsnames.ora file on the database host. If a comma appears in the listener address, then the entire string must be enclosed in quotation marks.
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 syntax of the LISTENER attribute is as follows:
The LISTENER attribute overrides the REMOTE_LISTENER initialization parameter. Because the REMOTE_LISTENER initialization parameter and the LISTENER attribute enable LREG to register dispatcher information with the listener, you do not need specify both the parameter and the attribute if the listener values are the same.
For example, assume that a remote listener named listener-sales2 listens on port 1521 on host sales2-server , and a database resides on host sales1-server . You want the listener on sales2-server to redirect connection requests to this database. Figure 9-1 illustrates this scenario.
Figure 9-1 Remote Listener
Description of »Figure 9-1 Remote Listener»
Oracle Database SQL Reference for additional information about the ALTER SYSTEM SET statement
Example 9-2 shows how to register a remote listener in a dedicated server environment. In the example, the remote listener is sales2-server .
Example 9-2 Registering a Remote Listener in a Dedicated Server Environment
On the host where the remote listener resides, use Oracle Net Manager to configure the listener.ora file with the protocol addresses of the remote listener.
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:
For shared server connections, set the DISPATCHER parameter in the initialization file for the database on host sales1-server as follows:
To statically update the REMOTE_LISTENER initialization parameter, use a text editor to de-register the information with the remote listener which it had previously registered information.
Resolve the listener name alias for the remote listener through a tnsnames.ora file on the database host. For example:
Oracle Database Reference to learn about the REMOTE_LISTENER initialization parameter
Oracle Real Application Clusters Administration and Deployment Guide to learn how to configure remote listeners (also called SCAN listeners) in an Oracle RAC environment
Registering Information with All Listeners in a Network
A network may contain multiple local and remote listeners. By default, all listeners are cross-registered with each other. By specifying a set of listeners in the LISTENER_NETWORKS initialization parameter, you can designate a subset of local listeners with a subset of remote listeners. Listeners specified by the LISTENER_NETWORKS parameter should not be specified by the LOCAL_LISTENER and REMOTE_LISTENER parameters.
The syntax of LISTENER_NETWORKS parameter is as follows:
In the preceding syntax, listener_address is resolved according to the rules of LOCAL_LISTENER and REMOTE_LISTENER.
Example 9-3 Using Two Networks on a Subnet
Assume there are two distinct networks, network1 and network2 . On network1 , there is a local listener named local1 , and a remote listener named remote1 . On network2 , there is a local listener named local2 , and a remote listener named remote2 . The following syntax sets up registration so that the listeners only redirect connections to listeners on the same network.
In the preceding example, local1 is registered only with remote1 , and remote1 only redirects connections to local1 . The listener local2 is registered only with remote2 , and remote2 only redirects connections to local2 .
Example 9-4 Configuring Multiple Listeners
Assume that multiple listeners are listening on a network named sales-network . The following conditions are true:
A database configured for dedicated server connections resides on host sales1-server . It is the only database in the network.
A local listener resides on sales1-server and listens on nondefault port 1421.
A remote listener named resides on host sales2-server and listens on port 1521.
Another remote listener resides on host sales3-server and listens on port 1521.
The following procedure describes how to register information with all listeners in a dedicated server environment:
On the hosts where the remote listeners reside (in this example, sales2-server and sales3-server ), configure the listener.ora file with the protocol addresses of the remote listener.
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 listeners, and the LOCAL_LISTENER parameter to the alias of the local listener.
Set the parameters in the initialization file for the database on host sales1-server as follows:
Resolve the listener name alias for the LOCAL_LISTENER and REMOTE_LISTENER setting through a tnsnames.ora file on the database host.
In the tnsnames.ora on sales1-server , resolve the local listener alias and remote listener aliases listener_sales1 , listener_sales2 , and listener_sales3 as follows:
Oracle Database Reference for additional information about the REMOTE_LISTENER initialization parameter
Configuring a Naming Method
The listener name alias specified for the LOCAL_LISTENER or REMOTE_LISTENER initialization parameters, or LISTENER attribute can be resolved using a tnsnames.ora file. For example, a listener can be defined in the init.ora file as the following:
To use an alias for the listener, it can be defined in the init.ora and the tnsnames.ora files as follows:
In the init.ora file:
In the tnsnames.ora file:
The CONNECT_DATA information should not be included in the network service entry in the tnsnames.ora file. However, Oracle Enterprise Manager Cloud Control and Oracle Net Manager cannot configure a tnsnames.ora file without the CONNECT_DATA information. To use listener name aliases, Oracle recommends you modify the tnsnames.ora file using a text editor.
Multiple addresses are supported, but connect-time failover and client load balancing features are not supported.
If the listener alias specified in the LOCAL_LISTENER parameter is invalid or not resolved, then the LREG process does not allow the database to start. The following errors occur:
Chapter 13, «Enabling Advanced Features of Oracle Net Services» for additional information about multiple address configuration
Configuring Oracle Net Listener During Installation
Oracle Universal Installer launches Oracle Net Configuration Assistant during installation. Oracle Net Configuration Assistant configures the listening protocol address and service information for Oracle Database.
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 for the listener name and protocol address.
A listening IPC protocol address for external procedure calls is automatically configured, regardless of the installation type. Oracle Net Configuration Assistant also automatically configures service information for the external procedures in the listener.ora file.
If you are using the IPC protocol, then you can improve performance by specifying the maximum number of concurrent IPC connection requests to match your expected connection requests.
Customizing Oracle Net Listener Configuration
If the default or installed configuration is not adequate for a particular environment, then you can use Oracle Net Manager to customize the listener.ora configuration.
This section contains the following configuration topics:
Configuring Listening Protocol Addresses
Oracle Enterprise Manager Cloud Control and Oracle Net Manager can be used to configure protocol support for the listener.
The Oracle Net Listener endpoint address configuration accepts both IPv6 addresses and host names that resolve to IPv6 addresses, as explained in «IPv6 Interface and Address Configurations». This technique can create listening endpoints that service IPv6 clients.
Configuring Listening Protocol Addresses Using Oracle Enterprise Manager Cloud Control
The following procedure describes how to configure protocol addresses for the listener using Oracle Enterprise Manager Cloud Control:
Access the Net Services Administration page in Oracle Enterprise Manager Cloud Control.
Click Edit . You may be prompted to log in to the database server.
The Edit Listener page appears.
In the Addresses section, configure protocol support:
The Add Address page appears.
From the Protocol list, select the protocol on which the listener is configured to listen.
For TCP/IP, if the computer has more than one IP address and you want the listener to listen on all available IP addresses, then select TCP/IP or TCP/IP with SSL and enter the host name of the computer in the Host field.
In Port, enter the port number.
When configuring the listener to listen on TCP/IP, enter the default port of 1521. Otherwise, you must configure the LOCAL_LISTENER parameter in the initialization parameter file and the non-default port number must be specified for use by any naming method.
In Host, enter the host address.
(Optional) 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.
The protocol address is added to the Addresses section.
Repeat Step 3 for additional protocols.
Oracle Database Net Services Reference for additional information about protocol addresses and TCP/IP privileged ports
Configuring Listening Protocol Addresses Using Oracle Net Manager
The following procedure describes how to configure protocol addresses for the listener using Oracle Net Manager:
Start Oracle Net Manager.
In the navigator pane, expand Local , and then select Listeners .
Select the listener.
From the list in the right pane, select Listener Locations .
Select the protocol from the Protocol list.
Enter the host name for the listener in the Host field.
Enter the port number in the Port field.
If you want to set send and receive buffer sizes, then click Show Advanced , and then enter the sizes in the appropriate fields.
Select Save Network Configuration from the File menu to save the changes.
Handling 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, do the following:
Specify the QUEUESIZE parameter at the end of the protocol address with its value set to the expected number of concurrent requests.
The following example sets the queue size to 20:
The default number of concurrent connection requests is operating system-specific. The defaults for TCP/IP on the Linux operating system and Microsoft Windows follow:
Linux operating system: 128
Microsoft Windows XP Professional SP2: 10
Microsoft Windows Server Enterprise Edition: 200
Managing Oracle Net Listener Security
By default, Oracle Net Listener permits only local administration for security reasons. As a policy, the listener can be administered only by the user who started it. This is enforced through local operating system authentication. For example, if user1 starts the listener, then only user1 can administer it. Any other user trying to administer the listener gets an error. The super user is the only exception.
Oracle recommends that you perform listener administration in the default mode (secure by means of local operating system authentication), and access the system remotely using a remote login. Oracle Enterprise Manager Cloud Control can also be used for remote administration.
Specifying Valid Nodes and Subnets
Listener registration should be restricted to valid nodes and subnets. Valid nodes and subnets can be specified for registration, and excluded nodes can also be specified for registration. By default, every incoming connection for registration at the listener is subjected to IP-based filtering. A connection is only allowed if it originates from the local machine. If the other nodes and subnets are specified for registration, then the local machine and the ones specified are allowed. The following parameters can be set in the listener.ora file to specify valid and restricted nodes and subnets:
REGISTRATION_INVITED_NODES_ listener_name : Specifies the nodes that can register with the listener. The list can be host names, or CIDR notation for IPv4 and IPv6 addresses. Presence of a host name in the list results in all IP addresses mapped to it being invited.
REGISTRATION_EXCLUDED_NODES_ listener_name : Specifies the nodes that cannot register with the listener. Nodes not specified on the list are allowed to register with the listener.
If both parameters are set, then REGISTRATION_EXCLUDED_NODES_ listener_name is ignored.
Oracle Database Net Services Reference for additional information about valid node registration checking.
Administering the Listener
After the listener is configured, you can administer it with the Listener Control utility, Oracle Enterprise Manager Cloud Control, and the Server Control utility (SRVCTL). This section describes some of the administrative tasks for the listener. It contains the following topics:
Oracle Database Net Services Reference for a complete list of the Listener Control utility commands
Oracle Enterprise Manager Cloud Control online help
Starting and Stopping a Listener
To stop or start a listener, use one of the following methods:
You can configure the listener to start automatically whenever the computer is running or is restarted. Refer to «Managing a Listener in an Oracle Restart Configuration» for additional information.
Starting or Stopping a Listener Using the Listener Control Utility
To start the listener from the command line, enter:
In the preceding command, 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 name LISTENER .
In addition to starting the listener, the Listener Control utility verifies connectivity to the listener.
To stop a listener from the command line, enter:
In the preceding command, 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 name LISTENER .
When using the Oracle Home User, the listener control utility prompts for a password on Microsoft Windows systems. This password is the operating system password for the Oracle Home User. The password prompt is displayed only if the listener service does not exist and needs to be created as part of starting the listener.
Starting or Stopping a Listener Using Oracle Enterprise Manager Cloud Control
The following procedure describes how to start or stop a listener from Oracle Enterprise Manager Cloud Control:
Access the Net Services Administration page in Oracle Enterprise Manager Cloud Control.
Select Listeners from the Administer list, and then select the Oracle home that contains the location of the configuration files.
The Listeners page appears.
Select the listener.
From the Actions list, select Start/Stop .
The Start/Stop page appears.
Depending on the current status of the selected listener, select either Stop or Start , and then click OK .
Managing a Listener in an Oracle Restart Configuration
The Oracle Restart feature enhances availability for the processes and applications in a single-instance database environment. The Oracle Restart agents monitor the health of added components by periodically running check operations and restarting the components when necessary.
You can add the listener as a component to the Oracle Restart configuration. The listener is then automatically started by Oracle Restart when it fails or is not running. For example, if you restart the database instance after a planned restart of the computer, then Oracle Restart restarts the listener. Server Control (SRVCTL) is a command-line interface that you can use to manage listeners in an Oracle Restart configuration.
Viewing Configured Listeners Using the SRVCTL Utility
To view all configured listeners, use the following command:
Oracle Database Administrator’s Guide to learn how to configure Oracle Restart and for SRVCTL syntax and semantics
Adding or Removing a Listener Using the SRVCTL Utility
Adding a listener as an entry to the grid infrastructure enables the agent to monitor the listener. Similarly, removing a listener removes as an entry. Use the srvctl command at the operating system command line as follows:
To add the listener, enter srvctl add listener
The following command adds an entry for listener_sales1 to the grid infrastructure:
To remove the listener, enter srvctl remove listener
The following command removes the entry for listener_sales1 from the grid infrastructure:
Starting or Stopping a Listener Using the SRVCTL Utility
The SRVCTL utility enables you to stop and start the listener. If you do not specify the -listener parameter, then the SRVCTL utility starts and stops the default listener.
To start a listener, enter srvctl start listener
In the following example, the first command starts the default listener, and the second command starts listener1 and listener2 :
To stop a listener, enter srvctl stop listener
In the following example, the first command stops the default listener, and the second command stops listener1 and listener2 :
Determining 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 Cloud Control. 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.
Showing Status Using Listener Control
To show the status the listener from the command line, enter the following command:
In the preceding command, 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 name LISTENER .
Example 9-5 shows example output of the STATUS command.
Example 9-5 Listener Control Utility’s STATUS Command Output
The STATUS command output includes the sections described in Table 9-1.
Table 9-1 Listener Control Utility STATUS Command
Output Section | Description |
---|---|
Output Section | Description |
---|---|