REM script to look at the currently active SQL in the buffer and the user
REM and program responsible for it
REM
REM WARNING: This query is slow!
REM
REM

set linesize 100;
set pagesize 200;

column osuser format A10 trunc;
column osuser format A20 trunc;
column program format A30 trunc;

column disk_reads format 9,999,999,999;
column executions format 9,999,999,999;
column buffer_gets format 9,999,999,999;
column rows_processed format 9,999,999,999;

set time on;
set timing on;

select b.osuser,b.username,b.program,
c.disk_reads,c.executions,c.buffer_gets,c.rows_processed,
c.sql_text
from
v$session b, v$sqlarea c
where
b.sql_address = c.address and
b.username is not null and
b.status = ‘ACTIVE’ and
c.sql_text not like ‘%sqlarea%’
order by b.osuser,b.username;