Re: How to find SID?

From: Jay Broughton <jbrought_at_sugarland.unocal.com>
Date: 1996/07/17
Message-ID: <31ED553C.167EB0E7_at_sugarland.unocal.com>#1/1


Chuck Hamilton wrote:
>
> Che <cdiggens_at_banda.NTU.EDU.AU> wrote:
>
> >How can you find the oracle database you are connected to once you are
> >connected? I've got the userid but need to the database to later perform
> >an OP$ login back into oracle.
> > - Che
> >
>
> SELECT * FROM v$database;
> --
> Chuck Hamilton
> chuckh_at_dvol.com
>
> Never share a foxhole with anyone braver than yourself!

There is a way to always know which database your connected to by inserting the following lines to the glogin.sql file located in the $ORACLE_HOME/sqlplus/admin directory:

column sid new_value osid noprint
set termout off
select upper(substr(global_name,1,(instr(global_name,'.')-1))) sid from global_name;
set termout on
set sqlprompt'&osid> '

This will make your sqlplus prompt look like this:

"YOUR SID"> Example:

U01> select count(*) from well_hdr;

Hope this is helpful.


                _/     _/_/     _/    _/
               _/     _/ _/     _/   _/     Jay Broughton
              _/     _/  _/     _/  _/      713-287-5054
             _/     _/   _/     _/ _/     jbrought_at_sugarland.unocal.com   
            _/     _/_/_/_/     _/_/
  _/       _/     _/     _/      _/
  _/      _/     _/      _/     _/
   _/_/_/_/     _/       _/    _/
Received on Wed Jul 17 1996 - 00:00:00 CEST

Original text of this message