Tuesday, June 24, 2008

ORA-12541: TNS:no listener

For newbie users they found ORA-12541 and search here and there to solve the problem. But it is one word about the error which it says no listener and think next what to do. Never mix this error with another error like ORA-12514: which are different and mutually exclusive.

Error Description
---------------------------------------------
-bash-3.00$ sqlplus arju/a@neptune/saturn


SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jun 24 06:39:15 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

ERROR:
ORA-12541: TNS:no listener

Cause of the Problem:
--------------------------------------

Listener service is not running in the database to which you are requested to connect. Here we see that is neptune database. If you use tnsnames.ora then look at host parameter value in it.

Solution of the Problem:
----------------------------------

Solution of the problem is straightforward which is start the listener. It is done by lsnrctl start in the server machine to which you connect.
Step1:
---------

First check status by
$lsnrctl status

If you have default named listener which is LISTENER then lsnrctl status is fine. However if you don't have default listener then from listerner.ora see the available listener. And use that name after status. If your listener name is TEST_LISTERNER then use,
$lsnrctl status TEST_LISTERNER
LSNRCTL for Solaris: Version 10.2.0.1.0 - Production on 24-JUN-2008 06:55:08

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC2)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Solaris Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=neptune)(PORT=1522)))
TNS-12541: TNS:no listener
TNS-12560: TNS:protocol adapter error
TNS-00511: No listener
Solaris Error: 146: Connection refused

If you get TNS-00511 then go to step 2 otherwise if you get listener status then go to step 3.

Step 2:
---------------

Start the listener.
If you have default listener then use
-bash-3.00$ lsnrctl start

LSNRCTL for Solaris: Version 10.2.0.1.0 - Production on 24-JUN-2008 06:53:50

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

Starting /oracle/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
.
.

If you have other than default then use that name like,
$ lsnrctl start NON_DEFUALT_LISTENER
Step 3:
--------------

It is natural after starting listener service it takes minute to register the service of the listener. You can dynamically service of the listner by issuing following command in SQL*Plus,
SQL> alter system register;
System altered.

Step 4:
------------------

Try to connect to database using connection identifier. If you still get error ORA-12541 then check the addition settings of the connection identifier. If you use tnsnames.ora then also check settings listener post. This all can be seen after issuing lsnrctl status command

Like in this example my listener port is 1522 and if I use 1521 in my connection identifier error will come.
-bash-3.00$ lsnrctl status

LSNRCTL for Solaris: Version 10.2.0.1.0 - Production on 24-JUN-2008 07:02:18

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC2)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Solaris: Version 10.2.0.1.0 - Production
Start Date 24-JUN-2008 07:01:52
Uptime 0 days 0 hr. 0 min. 26 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /oracle/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC2)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=neptune)(PORT=1522)))
.
.

-bash-3.00$ sqlplus arju/a@neptune:1521/dbase

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jun 24 07:06:00 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.

ERROR:
ORA-12541: TNS:no listener

As listener is running on port 1522 so connect to port 1521 will fail.
-bash-3.00$ sqlplus arju/a@neptune:1522/dbase


SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jun 24 07:06:15 2008

Copyright (c) 1982, 2005, Oracle. All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

No comments:

Post a Comment