[oracle] 查詢歷史會話、歷史執行計劃

匠人xin發表於2021-01-29

1.查詢歷史連線資訊
select *
from dba_hist_active_sess_history a
where a.SAMPLE_TIME BETWEEN
TO_DATE('2020-10-04 12:00:00', 'YYYY-MM-DD HH24:MI:SS') AND
TO_DATE('2020-10-04 13:00:00', 'YYYY-MM-DD HH24:MI:SS')


select *
from v$active_session_history D
WHERE d.SAMPLE_TIME BETWEEN
TO_DATE('2020-10-04 12:00:00', 'YYYY-MM-DD HH24:MI:SS') AND
TO_DATE('2020-10-04 13:00:00', 'YYYY-MM-DD HH24:MI:SS')

 
2.查詢歷史sql資訊


select * from v$sqlarea where sql_text like '%%';

3.查詢歷史執行計劃
select * from v$sql_plan;

如果快取內查詢不到,可以查詢DBA_HIST_SQL_PLAN表
select * from DBA_HIST_SQL_PLAN;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69993564/viewspace-2754380/,如需轉載,請註明出處,否則將追究法律責任。

相關文章