Mostly when you install your instant client, you will not have tnsping handy. You could well try to copy it from a full client, but this is cumbersome to just ping your instance.
I just created one function in my .profile
whence tnsping >/dev/null 2>&1 ||
tnsping() {
:| sqlplus -L -s x/x@$1 | grep ORA- | (grep -v ORA-01017 || echo OK)
}
and tested it
$ tnsping db999
ORA-12154: TNS:could not resolve the connect identifier specified
$ tnsping db01
OK
$ tnsping db02
ORA-12541: TNS:no listener
Nice 🙂 Thank you 🙂
Excellent. Simple, clean and effective.
Nice – it’s missing the trailing } for the function, so it should read
whence tnsping >/dev/null 2>&1 ||
tnsping() {
sqlplus -L -s x/x@$1
}
Apart from that, it does the job nicely.
Sorry, this was a WordPress issue, new editor doesn’t like <
Hi,
this is very nice tool!
Thank you
T.