Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

displaying sid & serial# of current user

onkar.nathFeb 29 2012 — edited Feb 29 2012
Hi,

I want to display sid and serial# of currently connected user but the sid & serial# should be displayed right after connection. I mean, once a user enters username/pass and press enter, before the SQL prompt, sid & serial# should be display. I tried running select sid,serial# from v$session where username=user; statement from glogin.sql file before setting the prompt but of no use. Even I tried creating a folder but could not. Below is my glogin.sql:

set lines 120
set pages 1000
set termout off
col sid new_value sid1
col prom new_value prom
select sys_context('USERENV','SESSION_USER')||'@'||sys_context('USERENV','DB_NAME')||'>' prom
from dual;

set sqlprompt ''
select sid,serial# from v_$session where username=user;
set sqlprompt "&prom "
set termout on
set lines 120
set pages 1500

Though Oracle version and OS is not applicable for this but still, I am running Oracle (9i,10g and 11g) on win xp. This is just a test system which I use for small testing of commands/triggers before deploying in any official environment.

TIA
-Onkar
This post has been answered by 627574 on Feb 29 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 28 2012
Added on Feb 29 2012
8 comments
12,726 views