If you already have a connection to the database then

select INSTANCE_NAME, HOST_NAME from V$INSTANCE;

If you are not connected to ORACLE and you want to find out what instances are 
available on the machine you can parse  the file
/etc/oratab or /var/opt/oracle/oratab on Sun/Solaris.  Nt is a bit harder, assuming 
you have used OFA then a directory will exists
for each SID under ORACLE_HOME/admin/SID_HERE.

You can get the host name from a Java function call.

Scott.

-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Godbey, David
Sent: Friday, August 31, 2001 8:22 AM
To: [EMAIL PROTECTED]
Subject: Re: urget


To get the instance:

select value from V$SYSTEM_PARAMETER
where name='db_name';

or

select value from V$SYSTEM_PARAMETER
where name='instance_name';

Beware that the typical user doesn't have access to that table, so you might
need to ask the dba for select access, or better still, write a stored
function that returns a parameter value given the input name.

I don't know why you would want the host, and I don't know how to directly
get it from Oracle. But consider: I use a parameter table to store hooks to
needed system services. For example, I use Oracle to send email
notifications, and Oracle needs to know the identity of the SMTP server for
that.

Alternatively, it might make sense for you to use JNDI to gain access to
needed system services. If messaging is the game, consider JMS.

Hope that helps,
Dave

-----Original Message-----
From: kabalieswaran D [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 31, 2001 4:11 AM
To: [EMAIL PROTECTED]
Subject: urget


 hi
 i want to know

how to find out the oracle host,sid, during the
runtime
 most urget

from
kabas

____________________________________________________________
Do You Yahoo!?
For regular News updates go to http://in.news.yahoo.com

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to