Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tnsping ping fails, even though I can successfully connect to database

In trying to establish connectivity from my workstation (actually, am seeing the same behavior on both WinXP32 and Win764 workstations) to an Oracle server, the first thing I always try is a tnsping. When I do so, this is what I get:

> C:\>tnsping MYDBNAME
> 
> TNS Ping Utility for 32-bit Windows:
> Version 10.2.0.1.0 - Production on
> 25-JAN-2 011 15:03:35
> 
> Copyright (c) 1997, 2005, Oracle.  All
> rights reserved.
> 
> Message 3511 not found; No message
> file for product=NETWORK,
> facility=TNSMessage  3512 not found;
> No message file for product=NETWORK,
> facility=TNSAttempting to contact
> (DESCRIPTION = (ADDRESS_LIST =
> (ADDRESS = (PROTOCOL = TCP) (HOST =
> thisismyservername.com)(PORT = 1577)))
> (CONNECT_DATA = (SID = MYDBNAME)))
> Message 3509 not found; No message
> file for product=NETWORK, facility=TNS

So, as you can see, it is properly detecting my tnsnames file, and picks up the correct server address and port for the specified database, but the tnsping fails with 3511 and 3509 errors.

The strange part is, using sqlplus or Toad, from the same workstation, I can connect to that very same database successfully.

Can anyone explain what is happening here?

FWIW:

The ORACLE_HOME system environment variable (and any other oracle environment variables) is not set.

Update

The ORACLE_HOME environment variable does not necessarily HAVE to be set, it seems to depend per machine somehow. My particular issue was: Oracle 10g has/had a known defect in that tnsping.exe simply didn't work. There is a patch

like image 699
tbone Avatar asked Jan 25 '11 22:01

tbone


People also ask

Why is Tnsping not working?

tnsping command not found means that the shell cannot find tnsping command in $PATH, you should add the path $ORACLE_HOME/bin to it.

What is the difference between Tnsping and ping?

Used with the –s option, ping will show the packets received and timing information. Once connectivity to the host is confirmed with ping, the next connection to test is the listener. The tnsping utility is used to determine whether or not an Oracle service can be successfully reached.

What does Tnsping mean?

TNSPING is a utility in the ORACLE HOME/bin directory used to test if a SQL*Net connect string can connect to a remote listener (check if the socket is reachable). Note: This utility only tests if the listener is available. It cannot tell if the databases behind the listener is up or not.


1 Answers

I believe this can happen when your ORACLE_HOME environment variable is not set properly. tnsping is still available from the PATH, but it can't find its message files. What does echo %ORACLE_HOME% show, and where is the Oracle client actually installed?

This wouldn't necessarily have any effect on access from Toad as it doesn't need to access ORACLE_HOME directly; you may have given a full connection string, or it may be able to pick up a service name if TNS_ADMIN is set.

Edit You might also have several Oracle products that are interfering with each other. If so try going to Start->All programs->Oracle Installation Products->Home Selector and picking the one that is related to the tnsping you're executing. (Actually this is for the 9i client; I think for 10g you might need to use the universal installer, changing via Installed Products->Environment, but can't check).

like image 200
Alex Poole Avatar answered Sep 18 '22 11:09

Alex Poole