ORA-12545: Connect failed because target host or object does not exist

Connectivity errors are common questions on Oracle related forums and in many cases they are highly misunderstood by the poster of the questions and some responders.

This aim of this document is to show a method for diagnosis and resolution to a scenario in which an ORA-12545 is raised during the connection to a database.

Problem

You attempt a connection to database through SQL*Plus and you receive the following error.

[oracle@ora2 ]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Wed Jun 30 10:29:27 2010

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

SQL> connect hr@proddb
Enter password: 
ERROR:
ORA-12545: Connect failed because target host or object does not exist


SQL> 

Diagnosis process

If you are unfamiliar with the error use the oerr utility to get more information on the error.

[oracle@ora2 ]$ oerr ora 12545
12545, 00000, "Connect failed because target host or object does not exist"
// *Cause: The address specified is not valid, or the program being 
// connected to does not exist.
// *Action: Ensure the ADDRESS parameters have been entered correctly; the
// most likely incorrect parameter is the node name.  Ensure that the 
// executable for the server exists (perhaps "oracle" is missing.)
// If the protocol is TCP/IP, edit the TNSNAMES.ORA file to change the
// host name to a numeric IP address and try again.
[oracle@ora2 ]$

Nowhere in the error description above is any mention of this problem being related to the listener. This error is due to the inability of TNS to contact the host in the ADDRESS parameter for the database entry. This could be due to a typo in the host name or IP address. You do not have to take my word for it though. If you set up Oracle Net Services tracing on the client you should see something similar to the following.

(3086055104) niotns: Calling address: (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=pr0d)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=proddb)(CID=(PROGRAM=sqlplus)(HOST=ora2.localdomain)(USER=oracle))))
(3086055104) nscall: connecting...
(3086055104) snlinGetAddrInfo: getaddrinfo() failed with error -3
(3086055104) nlad_expand_hst: GetAddrInfo call failed
(3086055104) nsc2addr: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=pr0d)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=proddb)(CID=(PROGRAM=sqlplus)(HOST=ora2.localdomain)(USER=oracle))))
(3086055104) snlinGetAddrInfo: getaddrinfo() failed with error -2
(3086055104) nttbnd2addr: looking up IP addr for host: pr0d
(3086055104) snlinGetAddrInfo: getaddrinfo() failed with error -3
(3086055104) nttbnd2addr:  *** hostname lookup failure! ***
(3086055104) nserror: nsres: id=0, op=77, ns=12545, ns2=12560; nt[0]=515, nt[1]=111, nt[2]=0; ora[0]=0, ora[1]=0, ora[2]=0
(3086055104) nioqper:  error from nscall
(3086055104) nioqper:    ns main err code: 12545
(3086055104) nioqper:    ns (2)  err code: 12560
(3086055104) nioqper:    nt main err code: 515
(3086055104) nioqper:    nt (2)  err code: 111
(3086055104) nioqper:    nt OS   err code: 0
(3086055104) niqme: reporting NS-12545 error as ORA-12545
(3086055104) niotns: Couldn't connect, returning 12545

Here we see that the call to getaddrinf() failed with error. There was also a failure in attempting to get the IP address of pr0d. So here the trace shows that we were not even able to contact the host server let alone the listener.

Resolution

In the trace we can see the typo in the name of the host. The HOST= should be prod not pr0d. Changing that in the ORACLE_HOME/network/admin/tnsname.ora should resolve the problem. A trace is not necessary to resolve this issue successfully. The output from the oerr utility gave us the correct direction. We could have easily looked at the ORACLE_HOME/network/admin/tnsnames.ora file and seen that the host name was incorrect.

The ORA-12545 is not an indication that the network is down or that the host file or DNS has an incorrect address for the host in question. In those cases an ORA-12543 will be given.

9 thoughts on “ORA-12545: Connect failed because target host or object does not exist”

  1. I have ORA-12545 error in the DB client logs, but no error in the listener logs. What puzzles me is that we get this error for about 10 minutes, and then (without changing anything), the same DB client process successfully logs into Oracle. Would you have another suggestion where to look ?

  2. Note: Unfortunately, the resolution provided by the author did not help us.

    Hi Tremblay

    We faced a similar issue with Blackboard application on linux (4 app servers), and oracle rac database. (works fine for sometime and then doesn’t).

    our linux tech support gave us the following solution, and it worked:

    the app-server1 was running NetworkManager, which was causing the reset of dns server entries under /etc/init.d/NetworkManager. As a result, the app server couldn’t even ping to the database. (See if you can ping)

    The NetworkManager has to be disabled, and entries have to be added again.

    Do try this and see if this solves the issue.

    Sanaullah

  3. The problem has been resolved. I was not even able to tnsping the Oracle server. So I modified <> to replace the NAMES.DIRECTORY_PATH which specifies the order of naming methods that are used when a client tries to connect to a database.

    I modified
    NAMES.DIRECTORY_PATH= (TNSNAMES)
    for
    NAMES.DIRECTORY_PATH= (TNSNAMES, HOSTNAME, ONAMES)

    Since then : everything works.

    Thank you

  4. I am facing somewhat similar issue. I have a test windows physical machine in which I am running test instances of jira, confluence and fisheye on the same machine. The oracle databases are hosted on the same machine. One of the network guys renamed the computer’s name recently. I do not use this machine often so just came to know. I updated the TNS entries with the new computer name and rebooted the machine. When I try to connect to the databse, I get the error of no listener. Then I tried restarting the listener nad got the following error:

    C:\Documents and Settings\Administrator>lsnrctl start

    LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 – Production on 26-OCT-2013 12:39
    :07

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

    Starting tnslsnr: please wait…

    TNSLSNR for 64-bit Windows: Version 11.2.0.1.0 – Production
    System parameter file is E:\app\Administrator\product\11.2.0\dbhome_1\network\ad
    min\listener.ora
    Log messages written to e:\app\administrator\diag\tnslsnr\qa-misc\listener\alert
    \log.xml
    Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521
    ipc)))
    Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=QA12)(PORT=1521)))

    TNS-12545: Connect failed because target host or object does not exist
    TNS-12560: TNS:protocol adapter error
    TNS-00515: Connect failed because target host or object does not exist
    64-bit Windows Error: 1001: Unknown error

    Listener failed to start. See the error message(s) above…

    Any suggestions?

  5. hi i am facing the same issue I just want to know that whether I have to do any configuration with server system or should I configure the client server Please help me out

  6. This below is working, I have changed the /etc/hosts file its working,
    Thanks

    The problem has been resolved. I was not even able to tnsping the Oracle server. So I modified to replace the NAMES.DIRECTORY_PATH which specifies the order of naming methods that are used when a client tries to connect to a database.

    I modified
    NAMES.DIRECTORY_PATH= (TNSNAMES)
    for
    NAMES.DIRECTORY_PATH= (TNSNAMES, HOSTNAME, ONAMES)

    Since then : everything works.

    Thank you

  7. Hi,I log on to your new stuff named “ORA-12545: Connect failed because target host or object does not exist” like every week.Your humoristic style is awesome, keep up the good work! And you can look our website about love spell.

Leave a Reply

Your email address will not be published. Required fields are marked *