查看Oracle数据库SQL执行历史
-- 找出哪个数据库用户用什么程序在最近三天执行过delete或truncate table的操作 SELECT c.username, a.program, b.sql_text, 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;