Usually, when you connect to Oracle, you get errors that give you some feedback on what is happening.
Today, I got an issue where when trying to connect to SQLplus or even running a tnsping command was hanging. Not getting any error to start the troubleshooting. The issue was definitely some sort of connectivity but not able to point it out
In our case, we use “nameserver” in addition to tnsnames.ora. Our sqlnet.ora file looks like this:
I needed to trace my “tnsping” command to see where it is getting hung.
To troubleshoot the issue with tnsping hanging, all you need to do is add these settings in sqlnet.ora to trace tnsping
TNSPING.TRACE_LEVEL = ADMIN
My being a linux box and hence the path. You may need to modify according to your OS and directory
I ran the “tnsping” to the same Oracle SID again, a trace file “tnsping.trc” got generated in the path defined in the above “TNSPING.TRACE_DIRECTORY” variable.
Careful review of the trace file revealed that he connection was having an issue with the “name server” defined in my sqlnet.ora file.
I asked the Oracle DBA to confirm if the “name server” is started and she confirmed that it is not. Once she started the “name server”, tnsping command went successfully and I was able to connect to SQLplus.
Hope this helps you in some way.