Solved

TNSPING working SQLPLUS not working

Posted on 2003-12-01
27
7,311 Views
Last Modified: 2012-06-27
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...!!!
0
Comment
Question by:catchmeifuwant
  • 9
  • 9
  • 7
  • +2
27 Comments
 
LVL 13

Accepted Solution

by:
anand_2000v earned 25 total points
Comment Utility
1)is PING to the server working?
0
 
LVL 13

Expert Comment

by:anand_2000v
Comment Utility
can you see any difference between the sqlnet.ora file in the client and server?
0
 
LVL 12

Author Comment

by:catchmeifuwant
Comment Utility
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...

NAMES.DIRECTORY_PATH= (TNSNAMES)
SQLNET.EXPIRE_TIME=15
0
 
LVL 13

Expert Comment

by:anand_2000v
Comment Utility
ok
1)is the database up?
2) are the tnsnames.ora values specified with the domain?
0
 
LVL 13

Expert Comment

by:anand_2000v
Comment Utility
are you trying with computer name or ipaddress?
0
 
LVL 12

Author Comment

by:catchmeifuwant
Comment Utility
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
0
 
LVL 13

Expert Comment

by:anand_2000v
Comment Utility
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
host=YOUR_SERVER
port=9021

regards

0
 
LVL 13

Expert Comment

by:anand_2000v
Comment Utility
or on windows I believe there is a command called as "route"
0
 
LVL 12

Author Comment

by:catchmeifuwant
Comment Utility
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?
0
 
LVL 13

Expert Comment

by:anand_2000v
Comment Utility
sorry it was
redir --lport=9021 --cport=1521 --caddr=<RSERVER ADDRESS>&
0
 
LVL 13

Expert Comment

by:anand_2000v
Comment Utility
no.... that's the dispatcher....
remote machine is in which OS?
0
 
LVL 8

Assisted Solution

by:baonguyen1
baonguyen1 earned 25 total points
Comment Utility
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
0
 
LVL 13

Expert Comment

by:anand_2000v
Comment Utility
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
host=SERV1
port=9021

instead of what is present now.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 12

Author Comment

by:catchmeifuwant
Comment Utility
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.

0
 
LVL 47

Assisted Solution

by:schwertner
schwertner earned 25 total points
Comment Utility
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;
0
 
LVL 12

Author Comment

by:catchmeifuwant
Comment Utility
schwertner,

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)
0
 
LVL 8

Expert Comment

by:baonguyen1
Comment Utility
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).

solution:

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).
0
 
LVL 12

Author Comment

by:catchmeifuwant
Comment Utility
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?

0
 
LVL 8

Expert Comment

by:baonguyen1
Comment Utility
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
0
 
LVL 8

Expert Comment

by:baonguyen1
Comment Utility
The trace file is in: $ORACLE_HOME\bin
0
 
LVL 12

Author Comment

by:catchmeifuwant
Comment Utility
baonguyen1,

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>
0
 
LVL 8

Expert Comment

by:baonguyen1
Comment Utility
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
0
 
LVL 12

Author Comment

by:catchmeifuwant
Comment Utility
well unfortunately,when ping is used,

ping n4004_4

I get the message

Pinging n4004_n [IP] with 32 bytes of data

...no domain name
0
 
LVL 8

Expert Comment

by:baonguyen1
Comment Utility
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
0
 

Assisted Solution

by:jbeckstrom
jbeckstrom earned 25 total points
Comment Utility
Instead of using a host name, try using an ip address
0
 
LVL 8

Expert Comment

by:baonguyen1
Comment Utility
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
0
 
LVL 12

Author Comment

by:catchmeifuwant
Comment Utility
Hi all,

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

I'm splitting up the points !!!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Add 0 to end of Number 21 71
Salary Amount Format 13 56
unable to get sorting resultset 15 44
Error executing command from server 6 25
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now