自学内容网 自学内容网

Oracle DBA_HIST_ACTIVE_SESS_HISTORY

...

SELECT
    t1.*
,    dbms_lob.substr(sqltext.SQL_TEXT,1000,1)
,    t1.SQL_ID
,    t1.SQL_PLAN_HASH_VALUE
,    'select * from table(DBMS_XPLAN.DISPLAY_AWR('''||t1.SQL_ID||''', '''||t1.SQL_PLAN_HASH_VALUE||''', '''', ''ALL''))' plan
,    'select * from table(DBMS_XPLAN.DISPLAY_CURSOR(''' || t1.SQL_ID || '''))' as plan2
FROM
    DBA_HIST_ACTIVE_SESS_HISTORY t1
LEFT OUTER JOIN
    DBA_HIST_SQLTEXT sqltext
ON
    t1.SQL_ID = sqltext.SQL_ID
WHERE
    t1.SAMPLE_TIME
        BETWEEN TO_DATE('2018-02-03 03:00:00','YYYY-MM-DD HH24:MI:SS')
        AND TO_DATE('2018-02-03 05:30:00','YYYY-MM-DD HH24:MI:SS')
ORDER BY
    t1.SAMPLE_TIME DESC


原文地址:https://blog.csdn.net/wuchunyu002/article/details/140463647

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!