热点buffer

查询热点buffer来自那些对象
select e.owner,e.segment_name,e.segment_type
    from dba_extents e ,
    (select * from (select addr , ts# , file# , dbarfil, dbablk, tch
       from x$bh order by tch desc)
       where rownum < 11) b
where e.relative_fno = b.dbarfil
and e.block_id <= b.dbablk
and e.block_id + e.blocks > b.dbablk;
--------------------------------------------------------------------
查到相关sql
select /*+rule*/ hash_value,sql_text from v$sqltext
where (hash_value,address) in (
      select a.hash_value,a.address
        from v$sqltext a,
             (select distinct a.owner,a.segment_name,a.segment_type
                     from dba_extents a,
                          (select dbarfil,dbablk
                             from (select dbarfil,dbablk
                                          from x$bh
                                     order by tch desc)
                                 where rownum < 11 ) b
                             where a.relative_fno = b.dbarfil
                                  and a.block_id <= b.dbablk
                                  and a.block_id + a.blocks > b.dbablk) b
                     where a.sql_text like '%'||b.segment_name ||'%'
                         and b.segment_type='TABLE')
 order by hash_value,address,piece

 

你可能感兴趣的:(sql)