Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

whoson.sql - Display stats on all users.

SQL Scripts

whoson.sql - Display stats on all users.

by  Michael42  Posted    (Edited  )
Code:
set echo off
-- whoson.sql
-- Purpose: Display stats on all users logged on to database.
-- -----------------------------------------------------------------------------   
set pagesize 9999
set linesize 200
col username        format a12
col sid             format 999
col serial#         format 99999
col process         format a13
col status          format a10
col machine         format a25
col login_time      format a20
col server_proc_pid format a15
col cmd             format 999
col last_call_min   format 999999.99
col log_time        format a14
col blksRead        format 999,999,999,999  

SELECT a.username, a.sid, a.serial#, a.process, a.status, a.machine, to_char(a.logon_time, 'mm/dd HH24:mi:SS') login_time,
       b.spid server_proc_pid, a.command cmd,a.last_call_et/60 "last_call_min",c.block_gets+c.consistent_gets blksRead
FROM  v$session a, v$process b, v$sess_io c 
WHERE a.paddr = b.addr
AND a.sid = c.sid
AND a.username IS NOT NULL
ORDER BY username
/ 
set echo on
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top