脚本之找出占用了Buffer Cache里大量的buffer的数据库对象

找出大量消耗(占用)了Buffer Cache(里的buffer的个数)的数据库对象。下面的语句就可以完成这一工作:
SQL> column c0 heading 'Owner'                     format a15
SQL> column c1 heading 'Object|Name'               format a30
SQL> column c2 heading 'Number|of|Buffers' //该数据库对象使用了的buffer的个数        format 999,999
SQL> column c3 heading 'Percentage|ofData|Buffer' //该数据库对象使用了的buffer的个数与buffer cache里总
buffer的个数的百分比    format 999,999,999
SQL> select
  2     owner                        c0,
  3     object_name                  c1,
  4     count(1)                     c2,
  5     (count(1)/(select count(*) from v$bh)) *100  c3
  6  from
  7     dba_objects o,
  8     v$bh        bh
  9  where
 10     o.object_id  = bh.objd
 11  and
 12     o.owner not in ('SYS','SYSTEM')
 13  group by
 14     owner,
 15     object_name
 16  order by
 17     count(1) desc
 18  ;
 
C0              C1                                     C2         C3
--------------- ------------------------------ ---------- ----------
PLSQLDEV        STANDARD_CITY                  17290      72.5860621
DBOWNER         MSG_LOG                        2          0.00839630
DBOWNER         COUNTRY_PK                     1          0.00419815
DBOWNER         PARAMETER                      1          0.00419815
DBOWNER         PARAMETER_PK                   1          0.00419815
DBOWNER         MSG_LOG_IDX1                   1          0.00419815
 
6 rows selected
 
SQL>

你可能感兴趣的:(脚本之找出占用了Buffer Cache里大量的buffer的数据库对象)