eece
eece

Reputation: 37

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

Have anyone encounter this error before? I tried to refer to this link: http://www.ardentperf.com/2007/04/02/local_listener-and-ora-12545/

But it doesn't really resolve our issue. Our scenario is that we are able to connect to the database however we will encounter this error when we try to select data from a view.

I have enabled Client-side sqlnet trace but i am unable to interpret what is the exact cause of the issue.

Any ideas anyone?

Thanks

Upvotes: 4

Views: 50614

Answers (4)

Tarik Waleed
Tarik Waleed

Reputation: 137

i've got this error and the reason for me was that I was trying to connect on the wrong PORT.

Upvotes: 0

Ashwin A.Vardhan
Ashwin A.Vardhan

Reputation: 11

I also had this issue, and since I was not using a tnsnames.ora file, I almost gave up hope, when I stepped on this link.
So, now my code looks like this:

import cx_Oracle 
connection_string = '''username/password@(DESCRIPTION=
                                            (ADDRESS_LIST=
                                                (ADDRESS=
                                                    (PROTOCOL=TCP)
                                                    (HOST=<host_name>)
                                                    (PORT=<port_numer>)
                                                )
                                            )
                                            (CONNECT_DATA=
                                                (SID=<your_SID>)
                                            )
                                        )'''
db = cx_Oracle.connect(connection_String)

Now you can create a cursor and write your query.
Note: This is not a recommended practice, but I used it just for testing.

Upvotes: 0

Jeremy Thompson
Jeremy Thompson

Reputation: 65554

For me the problem was the HOST was not being detected by name in the TNSNAMES.ora, using the IP address instead resolved it (I think its due to a domain controller issue):

XYZD =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 123.45.67.89)(PORT = 1521))
    (CONNECT_DATA = (SERVICE_NAME = XYZD))
  )

Do a command: “ping HOST” to find the servers IP address.

  • PING HOST
  • TELNET HOST PORT
  • TNSPING TNS_ALIAS

Edit:

Just ran into this again, this time it was a Firewall blocking TCP via the port.

Upvotes: 4

Roberto Navarro
Roberto Navarro

Reputation: 958

This issue can be multiple things:

1. Your TNSNAMES.ora isn't up to date

Fix: Find your Oracle Home Find Directory: /network/ADMIN/

TNSNAMES.ora should be in there if you're experiencing this issue on a local machine

2. Create TNS_ADMIN Environmental Variable

In my case:

Variable Name: TNS_ADMIN

Value: C:\Programs\Ora10g\network\ADMIN

For testing purposes, try connecting to the Oracle DB using sqlplus (you may already be trying this).

Upvotes: 0

Related Questions