SPUG: DBI question: Lookup given a SID

Eric.D.Peterson at alltel.com Eric.D.Peterson at alltel.com
Mon Jan 8 15:41:41 PST 2007

  Given a database name (i.e., SID) is there a way to lookup the
hostname and/or ip address?  For example I know the following:

		db:	dbname
		Host:	xxx.alltel.com
		IP:	nn.nn.nn.nn

  I'd like to do something like this in Perl.

		my ( $host, $IP ) = who ( $db );

 In this subroutine I'd do the lookup to get the hostname and IP
address.  Do ya'll know of Perl module that will do that?  Or am I just
dreaming?  I'd like this to work both on Win32 and Solaris Unix.

 I did some searching, but I must be looking in the wrong places as I
can't seem to find much in this area.  The issue is that my company no
longer has explicit listings in the TNSNAMES.ORA file.  So I just create
a simple connection string (my $conn = "dbi:Oracle:$sid";).  So
essentially all I know is the name of the database.  But in the case of
some sort of failure or error, I'd like to print out more then just the
SID name.  I'd like to say this database on this machine had a problem
with your query.

Thanks for any help you can provide.

The information contained in this message, including attachments, may contain 
privileged or confidential information that is intended to be delivered only to the 
person identified above. If you are not the intended recipient, or the person 
responsible for delivering this message to the intended recipient, Alltel requests 
that you immediately notify the sender and asks that you do not read the message or its 
attachments, and that you delete them without copying or sending them to anyone else. 

More information about the spug-list mailing list