Home » SQL & PL/SQL » SQL & PL/SQL » Retreiving domain name from SID?
Retreiving domain name from SID? [message #188811] Mon, 21 August 2006 15:57 Go to next message
savar
Messages: 2
Registered: August 2006
Junior Member
Hey,

What is the best way (if any) to retrieve the domain name (hostname) of a server given the SID of an instance running on it?

For example, I want to FTP files to the database server to use as source data for an external table. I want to be able to dynamically determine the name of the host to FTP to so that this same code works in multiple environments.

I can parse tnsnames.ora, but I'm hoping there's a more elegant approach -- something like a reverse DNS lookup, except for Oracle SIDs.

Any ideas?

Thanks,
Re: Retreiving domain name from SID? [message #188816 is a reply to message #188811] Mon, 21 August 2006 16:34 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>I can parse tnsnames.ora
At least for Unix, you can (easily) have multiple tnsnames.ora files; $ORACLE_HOME/network/admin, TNS_ADMIN, $HOME/.tnsnames.ora, etc.
The same alias can resolve to different SID on different hosts in different files.
Re: Retreiving domain name from SID? [message #188817 is a reply to message #188816] Mon, 21 August 2006 16:52 Go to previous message
savar
Messages: 2
Registered: August 2006
Junior Member
anacedent wrote on Mon, 21 August 2006 16:34

>I can parse tnsnames.ora
At least for Unix, you can (easily) have multiple tnsnames.ora files; $ORACLE_HOME/network/admin, TNS_ADMIN, $HOME/.tnsnames.ora, etc.
The same alias can resolve to different SID on different hosts in different files.



Excellent point. So maybe its safer to parse the output of tnsping?
Previous Topic: conditional where clause question
Next Topic: table creation
Goto Forum:
  


Current Time: Thu Dec 12 08:23:20 CST 2024