Re: How to find SID?

From: John Strange <jstrange_at_imtn.dsccc.com>
Date: 1996/07/28
Message-ID: <4tfvuf$ks5_at_tpd.dsccc.com>#1/1


Here is some code I think you might also want.

I created a login.sql to set my sqlplus prompt to the current instance and placed it's location in the SQLPATH environment variable. Now when I login, I get the instance name instead of the sql> prompt. Also, any time I change connections within sqlplus I do a _at_login to reset the prompt to the new instance.

rem /*********************************************************************
rem *
rem *   login.sql - sqlplus start up file
rem *
rem *   next four statements sets the sql prompt = oracle instance.
rem *
rem *********************************************************************/
 

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

rem /********** end of login.sql ***********************/

James A. Walker (jawalker_at_pbis.com) 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
 

: If your are using a version 7 server try:
 

: select * from global_name;
 

: If version 6 try:
 

: select * from v$parameter
: where name = 'db_name';
 

: Good luck!

--
This posting represents the personal opinions of the author. It is not the
official opinion or policy of the author's employer. Warranty expired when you
opened this article and I will not be responsible for its contents or use.
Received on Sun Jul 28 1996 - 00:00:00 CEST

Original text of this message