Displaying connected users

Displaying connected users

Post by Naru Mangala » Fri, 10 May 2002 13:17:10



Hi,
I am using the following select to display connected users:

select username,osuser,process, program from v_$session
where username is not NULL

This works fine except that it also displays this active sqlplus
session. How can I display all the connected users except the session
that displays it?

Thanks in advance!

Naru Mangalath

 
 
 

Displaying connected users

Post by Chris Weis » Fri, 10 May 2002 15:10:36


SELECT  USERNAME, OSUSER, PROCESS, PROGRAM
FROM    V$SESSION VS, V$MYSTAT VM
WHERE  VS.SID = VM.SID (+)
AND      VM.SID IS NULL;

By using a NULL outer join you can filter out your current session data in
V$MYSTAT from V$SESSION..

You can also look up your SID in v$mystat and simply put 'AND SID != ...'
instead of joining to V$MYSTAT within your query.

Good Luck!

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Chris Weiss

www.hpdbe.com
High Performance Database Engineering
Available for long and short term contracts


Quote:> Hi,
> I am using the following select to display connected users:

> select username,osuser,process, program from v_$session
> where username is not NULL

> This works fine except that it also displays this active sqlplus
> session. How can I display all the connected users except the session
> that displays it?

> Thanks in advance!

> Naru Mangalath