Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: which server am I on?
Stephen A Tahmosh writes:
> 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
>
Beware that there is a public accessible view holding a more general information:
select global_name from global_name ;
Stephan Witt
<stephan.witt_at_beusen.de> | "beusen" Software+Systeme GmbH fon: +49 30 549932-62 | Landsberger Allee 392 fax: +49 30 549932-21 | 12861 Berlin ---------------------------------------------------------------Received on Sat Dec 21 1996 - 00:00:00 CST
![]() |
![]() |