Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Instance Name in Sql Prompt
<FONT face=Arial color=#0000ff
size=2>Ramon;
In your startup directory on SQL Plus, you can automatically run a script that
will setup the environment like you want it. Its called
LOGIN.SQL.
<FONT face=Arial color=#0000ff
size=2>
Here
is a copy of mine:
<FONT face=Arial color=#0000ff
size=2>
set
termout onset pagesize 0set echo offset feedback offset
sqlprompt ''spool c:\temp.sqlselect 'set sqlprompt '''||name||' >
'';' from v$database;spool off_at_c:\temp.sqlset pagesize 35set
feedback onset termout off
What
this does is to take the name of the database from v$database and create a
temporary SQL file, then runs it. This will set my prompt to
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>INSTANCE_NAME >
<FONT face=Arial color=#0000ff
size=2>
where
INSTANCE_NAME is the name of the database.
<FONT face=Arial color=#0000ff
size=2>
For
example, if I log onto DEV then the SQLPROMPT will be
<FONT face=Arial color=#0000ff
size=2>
DEV
>
<FONT face=Arial color=#0000ff
size=2>
Hope
you can use it.
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>Kevin
<FONT face=Arial color=#0000ff
size=2>
p.s.
... Remember that this only works for the initialization of SQL
Plus. If you do a connect inside of your session then the prompt will not
change.
<FONT face=Tahoma
size=2>-----Original Message-----From: Ramon Estevez
[mailto:com.banilejas_at_codetel.net.do]Sent: Thursday, October 25,
2001 9:35 AMTo: Multiple recipients of list
ORACLE-LSubject: Instance Name in Sql Prompt
Hi
Friends,
<SPAN
class=578542714-25102001>
Excuse me for this dumb
question, how do I display the instance name in the
sql prompt. Have
3 DB and would like to know to which one I am connected.
<SPAN
class=578542714-25102001>
I mean something like
that.
<SPAN
class=578542714-25102001>
DBA1
>
DBA2
>
DB01
>
<SPAN
class=578542714-25102001>
<SPAN
class=578542714-25102001>Regards,
<SPAN
class=578542714-25102001>
Ramon E.
Estevez
<A
href="">com.banilejas_at_codetel.net.do
Dominican Republic
809-565-3121
Received on Thu Oct 25 2001 - 09:54:52 CDT
![]() |
![]() |