by http://webgeektutorials.blogspot.com

Thursday, June 28, 2012

Oracle DBA script: Monitor user activity on the DB

Code :


set linesize 80
set verify off message off echo off pause off timing off time off
set feedback off
column o format a8 heading 'O/S|User'
column u format a10 heading 'Oracle|Userid'
column s format a12 heading 'R-S|Name'
column txt format a45 heading 'Current Statement' word


spool monrbs
select osuser o,
username u,
segment_name s,
sa.sql_text txt
from v$session s,
v$transaction t,
dba_rollback_segs r,
v$sqlarea sa
where s.taddr = t.addr
and t.xidusn = r.segment_id(+)
and s.sql_address = sa.address(+)
/

spool off

No comments:

Post a Comment