oracle中按CPU资源消耗排序SQL

发布时间:2020-07-28 01:02:08 作者:ElanAir
来源:网络 阅读:690
  
  set lines 180
set pagesize 500
col INSTANCE_NUMBER for 99
col module format a10
col execs for 999,999,999
col etime for 999,999,999.9
col avg_etime for 999,999.999
col avg_cpu_time for 999,999.999
col avg_lio for 999,999,999.9
col avg_pio for 9,999,999.9
col begin_interval_time for a30
col node for 99999
break on plan_hash_value on startup_time skip 1
select * 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,
module
from (
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_time
from DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT SS
where ss.snap_id = S.snap_id
and ss.instance_number = S.instance_number 
and executions_delta > 0
and ss.begin_interval_time >= sysdate -3  
and s.PLAN_HASH_VALUE>0
)
group by INSTANCE_NUMBER,sql_id, plan_hash_value,module
order by 8 desc
)  where rownum <= 100;
/


推荐阅读:
  1. 修复消耗CPU 100% 的logrotate进程
  2. 查看消耗资源最多的SQL

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

cpu oracle 消耗高

上一篇:辅域抢夺FSMO五大角色之后,卸载时选中这是最后一台域控,提示操作失败

下一篇:分享一个学习cocos-html5的链接

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》