暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

抓取ash中TEMP_SPACE_ALLOCATED消耗最多的SQL_ID

Lucky 2024-08-01
84

1.抓取ashTEMP_SPACE_ALLOCATED消耗最多的SQL_ID

select sample_time, sql_id, sum(TEMP_SPACE_ALLOCATED/ 1024 / 1024 / 1024) GB

  from v$active_session_history a

 where sample_time between

        to_date('&date1', 'yyyy-mm-dd hh24:mi:ss') and

        to_date('&date2', 'yyyy-mm-dd hh24:mi:ss')

       and a.TEMP_SPACE_ALLOCATED is not null

 group by sample_time, sql_id

 order by 3 desc

 

2.抓取ash中的pga_allocated消耗的SQL_ID

select a.sample_time,

       a.sql_id,

       sum(a.pga_allocated / 1024 / 1024 / 1024) GB1

  from v$active_session_history a

 where pga_allocated is not null

       and sample_time between

        to_date('&date1', 'yyyy-mm-dd hh24:mi:ss') and

        to_date('&date2', 'yyyy-mm-dd hh24:mi:ss')

 group by a.sample_time, a.sql_id

 order by 3 desc

 

3.ASH中剖析各种操作类型的次数,这里以SQL_OPNAME、SQL_OPCODE字段来区分

select SQL_OPCODE,SQL_OPNAME,count(*) from v$active_session_history a

where  sample_time between

       to_date('&date1', 'yyyy-mm-dd hh24:mi:ss') and

       to_date('&date2', 'yyyy-mm-dd hh24:mi:ss')

       group by SQL_OPCODE,SQL_OPNAME;   

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论