Reputation: 614
I want to know how to find SQL queries executed at specified time window. E.g what queries oracle was executing on 2011-07-11:15:20:10.
Thanks.
Upvotes: 0
Views: 4913
Reputation: 1036
select a.sql_id,dbms_lob.substr(b.sql_text,4000,1) from dba_hist_active_sess_history a, dba_hist_sqltext b
where sample_time between to_date('20110711:15:20','yyyymmdd:hh24:mi')
and to_date('20110711:15:21','yyyymmdd:hh24:mi') and b.sql_id=a.sql_id
union all
select a.sql_id ,dbms_lob.substr(b.sql_text,4000,1)from v$active_session_history a ,v$sqlarea b
where sample_time between to_date('20110711:15:20','yyyymmdd:hh24:mi') and
to_date('20110711:15:21','yyyymmdd:hh24:mi') and b.sql_id=a.sql_id
Read more: Oracle SQL History | eHow.com
Upvotes: 2