TNSPING working SQLPLUS not working

Hi there,

I'm baffled with a problem in connecting a client to a server(remote connection).

The entries in tnsnames.ora on the server side are working fine(when connected from the server).I use the same configuration on my client side,but it doesn't work.

TNSPING for the connect strings are OK.

I get a couple of errors from SQLPLUS,like:

1)ORA-12545 : Connect failed because of target host or object does not exist
2)Oracle not available
3)Shared realm does not exist.

Thanks for your inputs...!!!
LVL 12
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

1)is PING to the server working?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
can you see any difference between the sqlnet.ora file in the client and server?
catchmeifuwantAuthor Commented:
1)Ping is also working.

2)There was no sqlnet.ora on the client side.So i added a copy of it on the client side.Still no use...

Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

1)is the database up?
2) are the tnsnames.ora values specified with the domain?
are you trying with computer name or ipaddress?
catchmeifuwantAuthor Commented:
1)DB is up and running.I can connect to the remote server(I login to the server and from terminal there ...possible).

2)No TNSNames are not specified with the domain

3)IP address
are the server and the remote  sun machines? if yes I can give you an exact solution otherwise you will have to find similiar options with your OS

>>I can connect to the remote server(RSERVER)(I login to the server(YOUR_SERVER) and from terminal there ...possible).

in YOUR_SERVER give the command

redir --lport=9021 --rport=1521 --ipaddress=<RSERVER ADDRESS>&

in the client machine change the TNSNAMES configuration with


or on windows I believe there is a command called as "route"
catchmeifuwantAuthor Commented:
Client is Win 2000 and Server is HP-UX 11

If I check v$dispatcher,then the port that appears is 49674...does this have anything to do with it?
sorry it was
redir --lport=9021 --cport=1521 --caddr=<RSERVER ADDRESS>&
no.... that's the dispatcher....
remote machine is in which OS?
Can you check the c:\winnt\system32\drivers\etc\hosts file and add the entry with host name, fully qualified domain name , IP address for the server. Try with host name in tnsnames.ora with fully qualified domain name
let me see if I am understanding your problem correctly

You have a server, let's say SERV1, from which when you try to connect to a remote DB present in server SERV2 the connection works perfectly.

However when you try the same from a client machine CLNT1, which is connected to SERV1 it does not work.

therefore you have to us the command
redir --lport=9021 --cport=1521 --caddr=SERV2&

and change the tnsnames in CLNT1 to

instead of what is present now.
catchmeifuwantAuthor Commented:
Oh...sorry if my responses were misleading..the scenario is:

I have a DB installed on Serv1(HP-UX).I connect to the DB from Serv1 (using tnsnames configured in Serv1),the connection is successful.

I now have a client Clin1(Win 2000).This client is in a remote location.I have the replica of tnsnames as on Serv1 and sqlnet.ora as well.

When I try connecting from Clin1 to DB on Serv1,thats where I face the problem.

tnsping only checks if the Listener on that server is alive.

The messages
1)ORA-12545 : Connect failed because of target host or object does not exist
2)Oracle not available
3)Shared realm does not exist.

show that:
1. You gave a wrong host name and/or service name
2. You gave correct host name/service name but the Oracle Instance doesn' started.

Make sure that the Oracle Instance on the server is started (look at the processes)
(on the server as sys: select status from v$instance;)
Look at the host name and service name and correct them:
as sys: select instance_name, host_name from v$instance;
catchmeifuwantAuthor Commented:

1)The host name and service name is right,as I'm using the same configuration from the server.
2)Instance is started.

a)V$instance -> status is open
b)Host_Name is the name of the host (not it's IP)
The TNS-12545 error normally occurs when the TCP/IP protocol cannot resolve a given hostname either when initiating a connection, or when resolving a hostname from a redirect packet

Diagnosing the Error
1. Create a level 16 trace file and reproduce the problem
a. edit the sqlnet.ora file
b. add the parameter TRACE_LEVEL_CLIENT=16
c. reconnect in order to receive the TNS-12545 error again
d. exit the connecting application (i.e. SQL*Plus)

2. Open the client trace (probably cli.trc) in a text editor
a. search for the line:
   "nttbnd2addr:  *** hostname lookup failure! ***"
b. The line above this line reveals the hostname trying to be resolved
   by TCP/IP (NOTE: SQL*Net does not resolve hostnames).


Add the hostname, returned by the trace, to the local hosts file and assign it the correct IP address (NOTE: this hostname may be a secondary network card on the server or in some cases you need to add the 'Hostname.DomainName'
of the server in the etc/Hosts file at the client side).
catchmeifuwantAuthor Commented:
when I add an entry in hosts file(on client side),sqlplus hangs and aborts with a timeout error.

BTW,do you want sqlnet.ora to be modified on the server side(not possible due to restrictions), or the client side?

It should be on the client side.

Can you try with this command from command from:

c:\nslookup <your_host_name>

to see if your ip and host is correct
The trace file is in: $ORACLE_HOME\bin
catchmeifuwantAuthor Commented:

OK,here are the results.

1)First time the trace showed,"hostname lookup failure"

2)Added an entry in etc/hosts.This time the error was 12535 TNS Operation timed out.It could resolve the host properly.

REgarding,nslookup...errors again:

*** Can't find server name for address <IP>: Non-existent domain
*** Default servers are not available
Server:  UnKnown
Address:  <IP>
OK, so your client can not lookup the server as it is an HP-UX.

Try this:

c:\ping <your_server_name>
Pinging <your_server_name>.<your_domain> (IP) with 32 bytes of data
Reply from ....

Use the host name and domain here. Try to tnsping fisrt when you have changed the hostname in the tnsnames.ora
catchmeifuwantAuthor Commented:
well unfortunately,when ping is used,

ping n4004_4

I get the message

Pinging n4004_n [IP] with 32 bytes of data domain name
I think there is problem with DNS resolution. My solution is:

1. Try with to add the hostname without domain name to the etc\hosts file to see if it works
2. Use nslookup with your client to see what is your domain or if you already know, use it:

c:\nslookup <your_client_name>

3. Ping your cleint itself to find the domain
Instead of using a host name, try using an ip address
yes, you can use IP but sometime it does not work.

I forgot, you can use

c:\ipconfig /all

to check your IP configuration. The domain of your organization should be here
catchmeifuwantAuthor Commented:
Hi all,

Thanks for all your support.It was some network configuration problem,that's been fixed.

I'm splitting up the points !!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.