Linux – TNS-12541 Error

configurationlinuxoracleoracle-11g-r2oracle-sql-developer

I have grid installed in my pc but the problem is LISTENER does not start automatically. I have to start listener manually and then only LISTENER get started. But before starting listener if you check the status first then here is what is shows if you try LSNRCTL STATUS. I followed following url but it did not work for me :
Linux Error: 111: Connection refused LSNRCTL

My question is how should I make the listener run automatically?

Please check the necessary required information below : –

[grid@netsystemsolution ~]$ lsnrctl status    
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 01-JAN-2015 12:01:56
Copyright (c) 1991, 2011, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=netsystemsolution[dot]com)(PORT=1521)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Linux Error: 111: Connection refused

If you check the status of the listener from crvctl then this is what it shows:

[grid@netsystemsolution ~]$ srvctl status listener 
PRCN-2044 : No listener exists
[grid@netsystemsolution ~]$ srvctl config listener
PRCN-2044 : No listener exists
[grid@netsystemsolution ~]$

Host information:

[root@netsystemsolution ~]# vi /etc/hosts
192.168.0.1 netsystemsolution[dot]com localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@netsystemsolution ~]# hostname
netsystemsolution [dot]com
[root@netsystemsolution ~]# ping netsystemsolution[dot]com
PING netsystemsolution[dot]com (192.168.0.1) 56(84) bytes of data.
64 bytes from netsystemsolution[dot]com (192.168.0.1): icmp_seq=1 ttl=64 time=0.033 ms
64 bytes from netsystemsolution[dot]com (192.168.0.1): icmp_seq=2 ttl=64 time=0.034 ms
64 bytes from netsystemsolution[dot]com (192.168.0.1): icmp_seq=3 ttl=64 time=0.042 ms
--- netsystemsolution[dot]com ping statistics --- 
6 packets transmitted, 6 received, 0% packet loss, time 5525ms
rtt min/avg/max/mdev = 0.033/0.035/0.042/0.008 ms
[root@netsystemsolution ~]#

I followed the following url for listener.ora,sqlnet.ora and tnsnames.ora configuration
http://oracle-base.com/articles/misc/oracle-network-configuration.php

LISTENER.ORA Information:

[grid@netsystemsolution ~]$ cd $ORACLE_HOME/network/admin
[grid@netsystemsolution admin]$
[grid@netsystemsolution admin]$ vi listener.ora

# Generated by Oracle configuration tools.
#LISTENER =
#  (DESCRIPTION =
#    (ADDRESS = (PROTOCOL = TCP)(HOST = netsystemsolution[dot]com)(PORT = 1521))
#  )
#ADR_BASE_LISTENER = /u01/app/grid
#ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER = ON
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = netsystemsolution[dot]com)(PORT = 1521))
      )
    )
  )
 SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = ORCL.netsystemsolution[dot]com)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
      (SID_NAME = ORCL)
    )
  )

SQLNET.ORAI Information:

[grid@netsystemsolution admin]$ vi sqlnet.ora
# sqlnet.ora Network Configuration File: /u01/app/11.2.0/grid/network/admin/sqlnet.ora
# Generated by Oracle configuration tools.
SQLNET.AUTHENTICATION_SERVICES= (ALL)
#NAMES.DIRECTORY_PATH= (TNSNAMES, HOSTNAME)
#ADR_BASE = /u01/app/grid
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)
NAMES.DEFAULT_DOMAIN = netsystemsolution[dot]com

TNSNAMES.ORA Information:

[grid@netsystemsolution admin]$ vi sqlnet.ora
# tnsnames.ora Network Configuration File: /u01/app/11.2.0/grid/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
#ORCL =
#  (DESCRIPTION =
#    (ADDRESS_LIST =
#      (ADDRESS = (PROTOCOL = TCP)(HOST = netsystemsolution[dot]com)(PORT = 1521))
#    )
#    (CONNECT_DATA =
#      (SERVICE_NAME = orcl)
#    )
#  )

ORCL.netsystemsolution[dot]com =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = netsystemsolution[dot]com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = ORCL.netsystemsolution[dot]com)
    )
  )


[grid@netsystemsolution ~]$ crsctl status res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       netsystemsolution                            
ora.FRA1.dg
               ONLINE  ONLINE       netsystemsolution                            
ora.asm
               ONLINE  ONLINE       netsystemsolution        Started             
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.cssd
      1        ONLINE  ONLINE       netsystemsolution                            
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.evmd
      1        ONLINE  ONLINE       netsystemsolution                            
ora.orcl.db
      1        ONLINE  ONLINE       netsystemsolution        Open                
ora.tstdbdup.db
      1        ONLINE  OFFLINE                                                   
[grid@netsystemsolution ~]$ 

Now I started listener manually with lsnrcrl command and here is what it shows:

[grid@netsystemsolution admin]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 01-JAN-2015 12:18:59
copyright (c) 1991, 2011, Oracle.  All rights reserved.
Starting /u01/app/11.2.0/grid/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /u01/app/11.2.0/grid/network/admin/listener.ora
Log messages written to /u01/app/grid/diag/tnslsnr/netsystemsolution/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=netsystemsolution[dot]com)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=netsystemsolution[dot]com)(PORT=1521)))

STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                01-JAN-2015 12:18:59
Uptime                    0 days 0 hr. 0 min. 6 sec
Trace Level               off
Security                  ON: Local OS Authentication 
SNMP                      OFF
Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/netsystemsolution/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=netsystemsolution[dot]com)(PORT=1521)))
Services Summary...
Service "ORCL.netsystemsolution[dot]com" has 1 instance(s).
Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

[grid@netsystemsolution admin]$

Now if you wait like 10 to 15 seconds, after this then this is what it shows:

[grid@netsystemsolution admin]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 01-JAN-2015 12:20:45
Copyright (c) 1991, 2011, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=netsystemsolution[dot]com)(PORT=1521)))

STATUS of the LISTENER
------------------------

Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                01-JAN-2015 12:18:59
Uptime                    0 days 0 hr. 1 min. 45 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/netsystemsolution/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=netsystemsolution[dot]com)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", status READY, has 1 handler(s) for this service...
Service "ORCL.netsystemsolution[dot]com" has 1 instance(s).
  Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@netsystemsolution admin]$

After starting listener, lsnrctl start... again if you need to see whether 1521 is running or not then here it is:

[grid@netsystemsolution admin]$ netstat -nltp
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name 
tcp        0      0 0.0.0.0:20335               0.0.0.0:*                   LISTEN      -                 
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      -                 
tcp        0      0 127.0.0.1:5939              0.0.0.0:*                   LISTEN      -                 
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      -                 
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      -                 
tcp        0      0 192.168.0.1:25              0.0.0.0:*                   LISTEN      -                 
tcp        0      0 :::111                      :::*                        LISTEN      -                 
tcp        0      0 :::1521                     :::*                        LISTEN                              7268/tnslsnr      
tcp        0      0 :::45877                    :::*                        LISTEN      -                 
tcp        0      0 :::22                       :::*                        LISTEN      -                 
tcp        0      0 ::1:631                     :::*                        LISTEN      -                 
tcp        0      0 ::1:25                      :::*                        LISTEN      -                 
tcp        0      0 :::28835                    :::*                        LISTEN      -      
[grid@netsystemsolution admin]$

I wonder where is the problem? Why I have to start listener manually? Why listener does not start automatically ? Please suggest.

Best Answer

The easiest way to register your listener at Oracle Grid Infrastructure is to run netca. If you want to configure the listener "LISTENER" you have to make sure that it does not exist in the listener.ora yet.

One more thing: You should always configure your own host in the /etc/hosts file.