ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 【转】设置db_keep_cache_size缓存,并把一个表缓存进去

【转】设置db_keep_cache_size缓存,并把一个表缓存进去

原创 Linux操作系统 作者:ewelamb 时间:2013-06-14 17:47:10 0 删除 编辑
alter system set db_keep_cache_size=80M --设置keep值大小
        alter table TBL_AIRCOMPANY storage(buffer_pool keep)--把表TBL_AIRCOMPANY设置成keep在pool池中
        ALTER TABLE TBL_AIRCOMPANY cache --让TBL_AIRCOMPANY可以缓存
        
        SELECT OBJECT_NAME, A.STATUS, COUNT(*)
 FROM V$BH A, USER_OBJECTS B
 WHERE A.OBJD = B.OBJECT_ID
 --AND OBJECT_NAME IN ('TBL_AIRCOMPANY')
 GROUP BY OBJECT_NAME, A.STATUS; --查看是否在缓存keep中
 
 


  --各个buffer的空间信息 

  select p.name,sum(a.cnum_repl) "total buffers",sum(a.anum_repl) "free buffers" from x$kcbwds a, v$buffer_pool p
    where a.set_id>=p.LO_SETID and
           a.set_id<=p.HI_SETID
    group by p.name; 

--脚本用来定位哪些object在buffer cache中存在,占用的buffer cache的量是多少以及占用的是什么类型的buffer cache。

select decode(pd.bp_id,1,'KEEP',2,'RECYCLE',3,'DEFAULT',

         4,'2K SUBCACHE',5,'4K SUBCACHE',6,'8K SUBCACHE',

         7,'16K SUBCACHE',8,'32KSUBCACHE','UNKNOWN') subcache,

         bh.object_name,bh.blocks 

from x$kcbwds ds,x$kcbwbpd pd,(select set_ds,

         o.name object_name,count(*) BLOCKS

         from obj$ o, x$bh x where o.dataobj# = x.obj

         and x.state !=0 and o.owner# !=0

         group by set_ds,o.name) bh

where ds.set_id >= pd.bp_lo_sid

and ds.set_id <= pd.bp_hi_sid

and pd.bp_size != 0

and ds.addr=bh.set_ds
order by  decode(pd.bp_id,1,'KEEP',2,'RECYCLE',3,'DEFAULT',

         4,'2K SUBCACHE',5,'4K SUBCACHE',6,'8K SUBCACHE',

         7,'16K SUBCACHE',8,'32KSUBCACHE','UNKNOWN'),bh.blocks;

 

select 
(select value from V$SYSSTAT where name='physical write total bytes')/
(select value from V$SYSSTAT where name='physical read total bytes')*100||'%' 写读比例
from dual

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/7191998/viewspace-763984/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2012-10-23

  • 博文量
    92
  • 访问量
    263887