If you are like me, then tnsping is an old friend you turn to every time there is an issue with accessing databases. It does not validate if the database can be found but if the listener responds for the service-name you want to reach. If you are not on the same machine, making sure the listener responds tends to be the first thing to validate.
It typically requires the Oracle Client driver software to be installed. It is easy but not always convenient to get installed as you may need more access to do so. Recently a client wanted to validate round trip timing to the listener from a large set of servers. Installing the client on all of them was not possible. We worked around it by not timing that but rather getting the connections and then timing speed of round trips to the database by running “select * from dual” repeatedly. Not the best test maybe, but it served the purpose.
However, today I found out that I do not need an Oracle client to do a tnsping. All you need is SQLcl, so just drop it in and run tnsping <address> at the prompt. It returns a timing in ms. You don’t get the same output as your do with the classic tnsping, but for validating connectivity to the listener it works very well.
I did tell you in my last post that SQLcl is turning into a tool for all sorts of work, not just running SQL in a database.
And yes, the “address” you give to tnsping can be anything you can use to log in to SQLcl. So a TNS-entry, ezconnect or some such.
SQL> tnsping my-host:1521/myservice