Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: which server am I on?

Re: which server am I on?

From: Stephen A Tahmosh <tahmossx_at_itd.ssb.com>
Date: 1996/12/19
Message-ID: <59bdan$ldf@svna0001.clipper.ssb.com>#1/1

lesliet_at_u.washington.edu (L. Tseng) wrote:
>Is there an easy way to tell what server your are on in a SQL*Plus
>session? How about the way to show the database/instance for the
>session? I found myself frequently confused over having serveral
>sql*plus sessions connecting to different Oracle servers (local,remote)
>and instances.
>
>Thanks,
>
>Leslie
>

One source of the data is: "select name from v$database;"

A login.sql file is always executed when you connect to sqlplus, if the login.sql file exists (also look into the glogin.sql file).
Try putting the following in a login.sql file in your current directory (or use SQLPATH environment variable to set a search list of directories for login.sql):

REM **************************************************************
REM * login.sql                                                  *
REM **************************************************************
set termout off
column upper(VALUE) new_value _DB_NAME
select upper(value) from v$parameter
where upper(name) = 'DB_NAME';

set SQLPROMPT '&_DB_NAME.> '

clear breaks
set termout on
set feedback on

When using this, keep in mind that, within the SQL*Plus session, if you subsequently connect to another Oracle instance (via connect user/pass_at_instance), the prompt will not get updated!.

Steve Tahmosh
State Street Bank Received on Thu Dec 19 1996 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US