历史sql plan

来源:互联网 发布:jquery.rotate.min.js 编辑:程序博客网 时间:2024/05/30 23:01

历史sql plan可以使用dbms_xplan,display_awr来展示

DBMS_XPLAN.DISPLAY_AWR(    sql_id            IN      VARCHAR2,   plan_hash_value   IN      NUMBER DEFAULT NULL,   db_id             IN      NUMBER DEFAULT NULL,   format            IN      VARCHAR2 DEFAULT TYPICAL);
如果要找历史某个时间点sql plan,如某个awr时间段。

可以先从dba_hist_active_sess_history中找到,得到栏位sql_id, sql_plan_hash_value

select * from dba_hist_active_sess_history  h where h.sample_time>=date1 and h.sample_time<=date2


使用dbms_xplan.display_awr显示当时的sql plan

0 0