分享一個查詢某個使用者過去一段時間內執行的SQL語句。

記錄每一次錯誤發表於2018-09-10

不是自己寫的,是分享別人的。

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部落格 ” ,連結:http://blog.itpub.net/31547066/viewspace-2213885/,如需轉載,請註明出處,否則將追究法律責任。

相關文章