Oracle Listener

NOTE: Commands below assume LISTENER_NAME environment variable is set in the .profile. If the variable is null then the command will act on the default Listener named LISTENER.

Check

Status

lsnrctl status ${LISTENER_NAME}

List

To get a list of running listeners on a UNIX server use:

ps -ef | grep tns | grep oracle | grep -v grep


oracle   16788     1  0 Feb01 ?        00:00:03 /u01/app/oracle/product/122010ORCL1/bin/tnslsnr listener1 -inheritoracle   17996     1  0 Feb01 ?        00:00:02 /u01/app/oracle/product/122010ORCL2/bin/tnslsnr listener2 -inherit

tnsping

tnsping mynetservicename

trcroute

trcroute mynetservicename

Manage

Start

lsnrctl start ${LISTENER_NAME}

Stop

lsnrctl stop ${LISTENER_NAME}

Reload

If you change the LISTENER.ORA you can reload the configuration without a full stop/start...

lsnrctl reload ${LISTENER_NAME}

Configure

LOCAL_LISTENER

You should explicitly tell the database which Listener to interact with using the LOCAL_LISTENER parameter...


TCP

ALTER SYSTEM SET LOCAL_LISTENER = "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=myhost)(PORT=1521)))" SCOPE=BOTH;

For 11.2.0.4 and above, see COST and VNCR in LISTENER.ORA. For 11.2.0.3 and earlier, consider using PROTOCOL=ipc (see below).

You can check what the value should be using...

lsnrctl stat ${LISTENER_NAME} | grep tcp


IPC

ALTER SYSTEM SET LOCAL_LISTENER = "(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))" SCOPE=BOTH;

The benefit of setting LOCAL_LISTENER to use the IPC protocol is that your database will only dynamically register with a listener on the same server. However, this will complicate any Data Guard configuration. This is the recommended mitigation for  CVE-2012-1675 in 11.2.0.3 and earlier. For 11.2.0.4 and later, use TCP and see COST and VNCR in LISTENER.ORA.

You can check what the value should be using...

lsnrctl stat ${LISTENER_NAME} | grep ipc

REMOTE_LISTENER

This is a CIS Benchmark requirement

Check

SELECT UPPER(VALUE)

  FROM V$SYSTEM_PARAMETER

 WHERE UPPER(NAME)='REMOTE_LISTENER'

   AND VALUE IS NOT NULL; 

Multi-Tenant Version...

SELECT DISTINCT UPPER(V.VALUE),

       DECODE (V.CON_ID,0,(SELECT NAME FROM V$DATABASE),

                        1,(SELECT NAME FROM V$DATABASE),

                          (SELECT NAME FROM V$PDBS B WHERE V.CON_ID = B.CON_ID))

  FROM V$SYSTEM_PARAMETER V

 WHERE UPPER(NAME) = 'REMOTE_LISTENER'

   AND VALUE IS NOT NULL; 

Change

ALTER SYSTEM SET REMOTE_LISTENER = '' SCOPE = SPFILE; 

Troubleshooting

TNS-01106

TNS-01106: Listener Using Listener Name Has Already Been Started

Two listeners cannot have the same port. Check that another listener is not already listening on the port specified.

TNS-01198

TNS-01198: Listener failed to initialize valid node list

Symptom

On 12c...

lsnrctl start


LSNRCTL for IBM/AIX RISC System/6000: Version 12.1.0.2.0 - Production on 18-FEB-2016 12:06:07
Copyright (c) 1991, 2014, Oracle. All rights reserved.
Starting /u01/app/oracle/product/12.1.0.2/bin/tnslsnr: please wait...
TNSLSNR for IBM/AIX RISC System/6000: Version 12.1.0.2.0 - ProductionTNS-01198: Listener failed to initialize valid node listNL-07010: failed to get subnet maskNL-00408: cannot find or read valueNL-00408: cannot find or read valueNL-00408: cannot find or read value

Listener failed to start (see the error message above). Things work fine using 11g listener with the same configuration.

Cause

VALID_NODE_CHECKING_REGISTRATION defaults to ON for 12c, but defaults to OFF for 11g.

Solution

In this example case, the issue is suspected to be related to an IPV6 address in the hosts file... but exact root cause not yet confirmed.

TNS-12516

TNS-12516: TNS:listener could not find available handler with matching protocol stack

This is often due to hitting the instance PROCESS limit.

TNS-12514

TNS-12514: TNS:listener does not currently know of service requested in connect descriptor

This normally means that the service you are trying to connect to is not running on this server. In a load balanced configuration you might expect this (e.g a setup where the clients are configured to try all Data Guard nodes so that they work without alteration after a failover/switchover).

Warnings

WARNING: Subscription for node down event still pending

Relates to ONS. Set to OFF in non-RAC environments.