Thursday, January 1, 2009

TNSPING

Oracle has a utility called tnsping that can be used to determine if a particular Oracle service (such as the database itself) can be reached from a particular client or server, and also how long it took.

Here is an example of how to test your connection to a service named service_name (in tnsnames.ora) 5 times.

TNS Ping Utility for 32-bit Windows: Version 9.2.0.5.0 - Production on 18-APR-20
08 09:42:15

Copyright (c) 1997 Oracle Corporation. All rights reserved.

Used parameter files:
C:\ORACLE9\network\admin\sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 10.72.1.1) (PORT = 1234)) (CONNECT_DATA = (SID = service_name) (GLOBAL_NAME = service_name.domain.com)))
OK (20 msec)
OK (0 msec)
OK (0 msec)
OK (10 msec)
OK (0 msec)

(Yes, I'm still using Oracle 9, stop laughing)

What kind of errors can come back? You might get TNS-03505 if the service name is invalid, or TNS-12541 if that name can't be resolved to a service with a functioning listener.

You may also be interested in the TRCROUTE utility which will give you information about the actual route the test packet took.

No comments:

Post a Comment