ORA-12541

From Oracle FAQ
Jump to: navigation, search

ORA-12541: TNS:no listener

Contents

[edit] What causes this error?

An ORA-12541 error occurs when the listener for the destination server is down or unreachable when you try to connect. This can be due to the listener not being started or being incorrectly configured, or it can be due to a network connection problem.

[edit] How to fix it

[edit] Make sure that the listener is up and listening on the address

For example if you want to connect to the instance with SID=ORCL on a computer named TAMIN_NT using TCP protocol on PORT=1521 then it means that a listener has to be associated with SID = ORCL on machine TAMIN_NT and be listening for TCP protocol on port 1521. The listener must be up and running when one requests a connection.

To check that the listener is up and running use operating system facilities (like Start -> Settings -> Control Panel -> Services under NT) or LSNRCTL (Listener Control Program.) The STATUS command of LSNRCTL shows the current state of the listener.

If the listener is up and running then it may not have been associated with correct instance or not listening for the specified protocol. This information is the Listener Parameter File ( a text file) usually located under ORACLE_HOME\Network|Admin with the name of listener.ora. The STATUS command of LSNRCTL also shows the current location of this file. However, in my personal experience a STOP and START command in LSNRCTL is required for the STATUS command to show latest changes, especially when there are multiple Oracle homes on the same computer. The listener parameter file consists of two parts. The first part is the specification of the protocols for which this listener is listening, and the second part specifies the instances to which this listener is attached. Check and make sure that they are correct. You may edit listener.ora file either by an ordinary text editor or by using the Oracle Net8 Assistant utility. Just keep in mind that a restart of the listener is required for the changes to be effective.

Here is an example listener.ora file:

# Filename......: listener.ora
# Node..........: local.world
# Date..........: 24-MAY-94 13:23:20
################
LISTENER =
 (ADDRESS_LIST =
  (ADDRESS=
   (PROTOCOL= IPC)
   (KEY= oracle.world)
  )
  (ADDRESS=
   (PROTOCOL= IPC)
   (KEY= ORCL)
  )
  (ADDRESS=
   (COMMUNITY= NMP.world)
   (PROTOCOL= NMP)
   (SERVER= NTSERVER)
   (PIPE= ORAPIPE)
  )
  (ADDRESS=
   (PROTOCOL= TCP)
   (Host= ntserver)
   (Port= 1521)
  )
  (ADDRESS=
   (PROTOCOL= TCP)
   (Host= ntserver)
   (Port= 1526)
  )
  (ADDRESS=
   (PROTOCOL= TCP)
   (Host= 127.0.0.1)
   (Port= 1521)
  )
  (ADDRESS=
   (PROTOCOL= SPX)
   (Service= ntserver_lsnr)
  )
 )
STARTUP_WAIT_TIME_LISTENER = 0
CONNECT_TIMEOUT_LISTENER = 10
TRACE_LEVEL_LISTENER = 0
SID_LIST_LISTENER =
 (SID_LIST =
  (SID_DESC =
   (GLOBAL_DBNAME = oracle.world)
   (SID_NAME = ORCL)
  )
  (SID_DESC =
   (SID_NAME = tan)
   (GLOBAL_DBNAME = tan.world)
  )
 )
PASSWORDS_LISTENER = (oracle)

If you can't make it work with this solution, open the network configuration assistant (netca), delete the listener that is not working and recreate a new listener.

[edit] Network connection problems

If the listener is up and correctly configured and the problem still persists, then check the network. A change in the IP address of the server (say because of IP conflict or DHCP and/or DNS changes) may have caused the problem. For example, in my environment the name TAMINWEB stands for 213.29.49.132 according to DNS and on most computers in the network. But on a certain computer I was receiving 'no listener' error while I could connect from the other computers. On that computer I executed the following command:

c:\> ping taminweb

and noticed that it's trying to ping 213.29.49.190 rather than 213.29.49.132 and I don't still know why. However I replaced the name TAMINWEB in my TNSNAMES.ORA file with the address: 213.29.49.132 and the problem was fixed.

When using the TCP, a TCP/IP route must be available between the client machine and the server. This may be tested using the ping utility. There are also situations when a specified protocol is disabled for a machine, say when conflicting IP addresses occur or a router device or software fails. In such cases it may be possible to reach the listener through other protocols like Named Pipes. In such cases you should call for the network administrator to fix the problem or you can change the protocol in use. To change the protocol, change the protocol entry and the parameters for the connection string in use, in TNSNAMES.ORA or for the method in use (Oracle Names or external naming services.) Say in the TNSNAMES.ORA one may start using conn_nmp (Named Pipes) after conn_tcp fails. However bear in mind that in this case the listener must support NMP too for a connection to be established. To have listener support a new protocol one may use Net8 Assistant, LSNRCTL or edit listener.ora manually and restart the listener using the host operating system facilities.