Oracle 查询历史执行的 SQL

2020-11-04   阅读(28)  

三天内执行的删除语句 

select * from 
( SELECT c.username,
         a.program,
         dbms_lob.substr(b.sql_text) as sql,
         b.command_type,
         a.sample_time
    FROM dba_hist_active_sess_history a
         JOIN dba_hist_sqltext b
            ON a.sql_id = b.sql_id
         JOIN dba_users c
            ON a.user_id = c.user_id
   WHERE     a.sample_time BETWEEN SYSDATE - 3 AND SYSDATE
         AND b.command_type IN (7, 85)
ORDER BY a.sample_time DESC) where sql like '%table_name%';

 

ConstXiong 备案号:苏ICP备16009629号-3