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

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博客 ” ,链接:http://blog.itpub.net/7191998/viewspace-763984/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/7191998/viewspace-763984/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值