Tuesday, September 17, 2013

TNS-12541: TNS:no listener


##########################
## Error
##########################

TNS-12541: TNS:no listener

### Full Error

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = hostp01)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED)
(SID = oralin)))
TNS-12541: TNS:no listener

##########################
#  Error Occurred
##########################

Error occured while trying to connect a database using its service name in 10.2.0.3.0 version and also tnsping of service name gives TNS-12541

##########################
## Command Executed
##########################

In terminal

tnsping oralin

##########################
## Issue Description.
##########################

### 11.2.0.3.0

#########################################
# 1) check whether listener is running or not
#########################################

+ASM @ hostp01:/opt/oracle/product/11.2.0.1/grid/network/admin
> ps -ef|grep tns
  oracle 16743  2737   0 01:00:52 ?           0:00 /opt/oracle/product/11.2.0.1/grid/bin/tnslsnr LISTENER -inherit
  oracle 16747 11537   0 01:00:58 pts/2       0:00 grep tns

From above output, we can see LISTENER is up and running.

#########################################
# 2) check services listened by LISTENER
#########################################

lsnrctl status LISTENER

+ASM @ hostp01:/opt/oracle/product/11.2.0.1/grid/network/admin
> lsnrctl status LISTENER

LSNRCTL for Solaris: Version 11.2.0.1.0 - Production on 17-SEP-2013 01:00:52

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Solaris: Version 11.2.0.1.0 - Production
Start Date                17-SEP-2013 01:00:52
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/11.2.0.1/grid/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/hostp01/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
The listener supports no services
The command completed successfully

Listener is not listening to any database service. So database is not using this listener.

##########################
## Solution
##########################

#########################################
# 1) check database home ( or ) Grid home listener.ora file
#########################################

Check database home or GRID home listener.ora to find the list of listeners configured and what are the services listening to that.

oralin @ hostp01:/opt/oracle/product/11.1.0.7/db_1/network/admin
> more listener.ora
# listener.ora Network Configuration File: /opt/oracle/product/11.2.0.1/grid/network/admin/listener.ora
# Generated by Oracle configuration tools.

LSNR_11G =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = hostp01)(PORT = 1521))
    )
  )

SID_LIST_LSNR_11G =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /opt/oracle/product/11.1.0.7/db_1)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (GLOBAL_DBNAME=+ASM)
      (SID_NAME = +ASM)
      (ORACLE_HOME = /opt/oracle/product/11.2.0.1/grid)
    )
    (SID_DESC =
      (GLOBAL_DBNAME=oralin.example.com)
      (SID_NAME = oralin)
      (ORACLE_HOME = /opt/oracle/product/11.1.0.7/db_1)
    )
  )


From the above output, we can see that a listener named " LSNR_11G " is configured in LISTENER.ora and oralin database is listened using this listener.

#########################################
# 2) Start the Listener
#########################################

+ASM @ hostp01:/opt/oracle/product/11.1.0.7/db_1/network/admin
> lsnrctl start LSNR_11G

LSNRCTL for Solaris: Version 11.2.0.1.0 - Production on 17-SEP-2013 03:34:38

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Starting /opt/oracle/product/11.2.0.1/grid/bin/tnslsnr: please wait...

TNSLSNR for Solaris: Version 11.2.0.1.0 - Production
System parameter file is /opt/oracle/product/11.2.0.1/grid/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/hostp01/lsnr_11g/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hostp01)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LSNR_11G
Version                   TNSLSNR for Solaris: Version 11.2.0.1.0 - Production
Start Date                17-SEP-2013 03:34:38
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/11.2.0.1/grid/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/hostp01/lsnr_11g/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=hostp01)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "oralin.example.com" has 1 instance(s).
  Instance "oralin", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully


+ASM @ hostp01:/opt/oracle/product/11.1.0.7/db_1/network/admin
> ps -ef|grep tns
  oracle 16743  2737   0 01:00:52 ?           0:01 /opt/oracle/product/11.2.0.1/grid/bin/tnslsnr LISTENER -inherit
  oracle 26233  2737   0 03:34:38 ?           0:00 /opt/oracle/product/11.2.0.1/grid/bin/tnslsnr LSNR_11G -inherit
  oracle 26240 11537   0 03:34:53 pts/2       0:00 grep tns

Now the tnsping output is successful and database can be connected.

oralin @ hostp01:/opt/oracle/product/11.1.0.7/db_1/network/admin
> tnsping oralin

TNS Ping Utility for Solaris: Version 11.1.0.7.0 - Production on 17-SEP-2013 04:45:58

Copyright (c) 1997, 2008, Oracle.  All rights reserved.

Used parameter files:
/opt/oracle/product/11.1.0.7/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = hostp01)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SID =

oralin)))
OK (0 msec)

No comments: