SQL - Show active
--  showactivesql.sql -------------------------------------------------------------------
--
--  Description: SQL - Show active
--               Shows all active sessions and the SQL's associated with those sessions
--
--  Library: tuning
--
--  Author: 
--
--  Usage: @oracle/tuning/showactivesql.sql
--
--  Revision History:
--
--  DATE       WHO		   WHAT
--  ---------  ----------  ------------------
--
--
----------------------------------------------------------------------------------------
--set pagesize 80 
--set linesize 132 
--set feedback off 
--set verify off 
--set echo off 
column address noprint 
column username format a12 
break on address skip 1 
select a.address , sql_text, osuser, username 
from v$sqltext a, v$session s 
where s.SQL_ADDRESS = a.ADDRESS and 
s.status = 'ACTIVE' and s.type !='BACKGROUND' 
order by a.ADDRESS, a.piece ;