Re: Oracle SID at run-time from SQL*Plus
Date: 1996/04/23
Message-ID: <4lhr70$23h_at_charnel.ecst.csuchico.edu>#1/1
In article <317B9464.93B_at_pip.dknet.sk>,
Joern Moeller-Nielsen <jmn_at_pip.dknet.sk> wrote:
>Can anybody help with our litle problem.
>
>We have a couple of Unix-machines, and we would like to
>see Oracle SID from within SQL*Plus.
>
>Is this posible?
>--
>
>- -
>Joern Moeller-Nielsen, jmn_at_pip.dknet.dk
>Dansk Industri, DK-1787 Copenhagen
>Tel: +45 33 77 30 52; Fax +45 33 77 33 00
It's quite possible, and in fact, pretty easy. The view v$database contains the SID of the attached database.
If you want to automatically see the SID, try the following, pasted into your 'glogin.sql' script located in $ORACLE_HOME/sqlplus/admin :
- snip ---- set termout off set feedback off
column name new_value dbname
select user||'> ' "name" from dual;
select name||'> ' "name" from v$database;
set sqlprompt '&dbname'
set termout on
set feedback on
---- snip ----
The above will attempt to copy the v$database column 'name' onto the SQL> prompt. Try it out. I got a version of this seom someone else months ago, and I love it.
My own enhancement was the 'user' select just before the 'name' select.
If the user you're logging on as can't see 'v$database', you'll at least get your username in the SQL prompt instead.
Hope it's helpful...
Kevin Fries
-- ------------------------------------------------------------- Kevin Fries kelfink_at_ecst.csuchico.edu CPD/PB, C Developer/DBA http://www.ecst.csuchico.edu/~kelfinkReceived on Tue Apr 23 1996 - 00:00:00 CEST