oracle中按CPU資源消耗排序SQL

來源:互聯網
上載者:User

標籤:oracle中cpu消耗高的sql

    set lines 180set pagesize 500col INSTANCE_NUMBER for 99col module format a10col execs for 999,999,999col etime for 999,999,999.9col avg_etime for 999,999.999col avg_cpu_time for 999,999.999col avg_lio for 999,999,999.9col avg_pio for 9,999,999.9col begin_interval_time for a30col node for 99999break on plan_hash_value on startup_time skip 1select * from (select INSTANCE_NUMBER,sql_id, plan_hash_value, sum(execs) execs, sum(etime) etime, sum(etime)/sum(execs) avg_etime, sum(cpu_time)/sum(execs) avg_cpu_time,sum(lio)/sum(execs) avg_lio, sum(pio)/sum(execs) avg_pio,modulefrom (select ss.snap_id, ss.instance_number node, begin_interval_time, s.INSTANCE_NUMBER,s.module ,sql_id, plan_hash_value,nvl(executions_delta,0) execs,elapsed_time_delta/1000000 etime,(elapsed_time_delta/decode(nvl(executions_delta,0),0,1,executions_delta))/1000000 avg_etime,buffer_gets_delta lio,disk_reads_delta pio,cpu_time_delta/1000000 cpu_time,(buffer_gets_delta/decode(nvl(buffer_gets_delta,0),0,1,executions_delta)) avg_lio,(cpu_time_delta/decode(nvl(executions_delta,0),0,1,executions_delta)) avg_cpu_timefrom DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT SSwhere ss.snap_id = S.snap_idand ss.instance_number = S.instance_number and executions_delta > 0and ss.begin_interval_time >= sysdate -3  and s.PLAN_HASH_VALUE>0)group by INSTANCE_NUMBER,sql_id, plan_hash_value,moduleorder by 8 desc)  where rownum <= 100;/


本文出自 “elanjie” 部落格,請務必保留此出處http://elanjie.blog.51cto.com/11847332/1912366

oracle中按CPU資源消耗排序SQL

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.