Monday, August 19, 2013

DB user activity tracking


set lines 480
set pages 50000
col SAMPLE_TIME format a25
col sql_text format a75
col program format a25
col machine format a25
col event format a30
SELECT sample_time,
  gvash.inst_id,
  session_id,
  session_serial#,
  user_id,
  gvash.sql_id,
  substr(event,0,30) event,
  substr(program,0,25) program,
  substr(sql_text,0,75) sql_text
FROM gv$active_session_history gvash,
  gv$sql gvs
WHERE gvash.user_id     =58
AND gvs.sql_id    = gvash.sql_id
AND gvash.inst_id = gvs.inst_id and sql_text is not null and sample_time like '31-JUN-13 %';
 

No comments:

Post a Comment