ITPub博客

首页 > 数据库 > Oracle > 调整buffer cache大小

调整buffer cache大小

原创 Oracle 作者:上帝的二公子 时间:2014-07-24 16:21:54 0 删除 编辑
Buffer Cache存放真正数据的缓冲区,shared Pool里面存放的是sql指令(LC中一次编译,多次运行,加快处理性能,cache hit ratio要高),而buffer cache里面存放真正的查询结果。Buffer Cache:由彼此独立的三个子cache(subcaches,也叫主buffer cache:keep,recycle,default)组成支持多种数据块的多缓冲池。注意system表空间只能用主数据块
1查看各个组件size(看buffer cache)
SQL> show parameter size

动态指定db_cache_size的大小
 SQL> alter system set db_cache_size=92M scope=both;

DB_CACHE_SIZE指定的是基于主块大小(primary block size)的default缓冲池(buffer pool)的大小

2.该参数至少是4M*CPU个数*grunule大小。


采集统计数据用来预测不同cache size下的性能,用视图v$DB_CACHE_ADVICE查看。


SQL> select component,current_size,user_specified_size,granule_size

  2  from v$sga_dynamic_components;

 查看是否启用动态buffer cache advisory参数.

SQL> show parameter advice


1.如果statistics_level的值是typical或all,则db_cache_size为on

2.三个值:on、off、ready;

ready是advisory关闭,但是系统为其分配了内存,off->ready->on,正常开启顺序;

ready->off/off->on,报错ORA-4031(inability to allocate from the shared pool)!只有ready->on->off来关闭


查看v$db_cache_advice视图收集的buffer cache advisory信息.

 SQL> select name,size_for_estimate,estd_physical_read_factor,estd_physical_reads


   2  from v$db_cache_advice;

NOTE: 在factor或reads变化不大的情况下,无需增加buffer cache因为不会带来significant benefit,根据视图




标准的查询语句应为:

select size_for_estimate,buffers_for_estimate,estd_physical_read_fact,estd_physical_reads

from v$db_cache_advice

where name='DEFAULT'

AND block_size=(select value from v$parameter where name='db_block_size')

AND advice_status='ON';

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

下一篇: ORACLE PGA 的调整
请登录后发表评论 登录
全部评论

注册时间:2014-05-02

  • 博文量
    5
  • 访问量
    14789