不是自己写的,是分享别人的。
with his as (
select sql_id, sql_exec_start,user_id
from dba_hist_active_sess_history t
where user_id = (select user_id from dba_users where username = 'JMSS')
and t.sql_exec_start between to_date('2017-09-09 080000','yyyy-mm-dd hh24miss')
and to_date('2018-09-09 230000','yyyy-mm-dd hh24miss') order by 2 desc
)
select * from dba_hist_sqltext where sql_id in (select sql_id from his);
其中username是某个用户的用户名。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31547066/viewspace-2213885/ ,如需转载,请注明出处,否则将追究法律责任。