Is it possible to开发者_运维技巧 perform a TNSPing on an Oracle Database programmatically?
I'm aware I could probably call the TNSPing program and parse any output generated but I'm looking for a more robust method of handling the database TNS Ping.
Having seen the Ping class on MSDN, I tried to use the example code found, but I think I would need some way to resolve the TNS name into an actual IP address for this method to work. Is this possible?
This Forum seems to suggest that attempting to use TNSPing is a waste of time and that actually attempting the connection would be of more use!
It seems that catching the exceptions that might get raised during communications with a database might be the only reliable way to test that an oracle database is still there.
Not sure you can directly - it's the Oracle client software that resolves the TNS name to an IP address and I don't know of any call on the Oracle.DataAccess.Client that would do that for you.
精彩评论