select size_for_estimate, buffers_for_estimate ,ESTD_PHYSICAL_READ_factor,ESTD_PHYSICAL_READS from v$db_cache_advice 
  2      where block_size='8192' and advice_status='ON';

中,size_for_estimate表示预计的数据库高速缓冲区的大小(即:db_cache_size的值)。ESTD_PHYSICAL_READS表示预计的物理读。

当增加数据库高速缓冲区的的时候,物理读(ESTD_PHYSICAL_READS)越少,说明命中率越高。

1.优化缓冲区大小、提高服务器的命中率
db_cache_size                        big integer 838860800
2.查看缓冲区命中率是否需要调优.

select 1 - ((physical.value - direct.value - lobs.value) / logical.value)
     "Buffer Cache Hit Ratio"
  from v$sysstat physical,v$sysstat direct,v$sysstat lobs,v$sysstat logical
  where physical.name = 'physical reads'
  and direct.name='physical reads direct'
  and lobs.name='physical reads direct (lob)'
  and logical.name='session logical reads';
当命中率>90%说明命中率很高了

3。获取推荐的值
select name,size_for_estimate,v$db_cache_advice.ESTD_PHYSICAL_READS from v$db_cache_advice 
where block_size='8192' and advice_status='ON';

set linesize 1000
---20100619Oracle9i数据 Solaris 9i操作系统
SQL> set linesize 1000
SQL> select size_for_estimate, buffers_for_estimate ,ESTD_PHYSICAL_READ_factor,ESTD_PHYSICAL_READS from v$db_cache_advice 
    where block_size='8192' and advice_status='ON';

SIZE_FOR_ESTIMATE BUFFERS_FOR_ESTIMATE ESTD_PHYSICAL_READ_FACTOR ESTD_PHYSICAL_READS
----------------- -------------------- ------------------------- -------------------
               80                 9925                   28.9757          1436311200
              160                19850                    2.1053           104360120
              240                29775                    1.5819            78413087
              320                39700                    1.4262            70693980
              400                49625                    1.3543            67131735
              480                59550                     1.278            63349434
              560                69475                    1.1893            58954568
              640                79400                    1.1325            56135206
              720                89325                    1.0762            53347837
              800                99250                         1            49569438
              880               109175                     .7067            35030953

SIZE_FOR_ESTIMATE BUFFERS_FOR_ESTIMATE ESTD_PHYSICAL_READ_FACTOR ESTD_PHYSICAL_READS
----------------- -------------------- ------------------------- -------------------
              960               119100                     .3991            19784701
             1040               129025                     .2305            11423374
             1120               138950                     .1927             9552903
             1200               148875                     .1506             7466278
             1280               158800                     .1501             7438186
             1360               168725                     .1501             7438186
             1440               178650                     .1501             7438186
             1520               188575                     .1501             7438186
             1600               198500                     .1501             7438186
SIZE_FOR_ESTIMATE  M 为单位:
当SIZE_FOR_ESTIMATE=80M 的时候 ESTD_PHYSICAL_READS=1436311200
当SIZE_FOR_ESTIMATE=1120M 的时候 ESTD_PHYSICAL_READS=9552903
当SIZE_FOR_ESTIMATE=1280M 的时候 ESTD_PHYSICAL_READS=7438186
之后ESTD_PHYSICAL_READS固定了
所以应该过大db_cache_size=1120M的值使得
4.修改发现DB_cache_size太大了。过大SGA区域解决
alter system set db_cache_size=1120M
--sga设置太小了导致
SQL>  alter system set db_cache_size=1120M;
alter system set db_cache_size=1120M
*
ERROR 位于第 1 行:
ORA-02097: 无法修改参数,因为指定的值无效
ORA-00384: 没有足够的内存来增加高速缓存的大小
之前的值
sga_max_size                         big integer 1494715120
SQL>alter system set SGA_MAX_SIZE=3500M scope=spfile;
系统已更改。

重新启动与关闭解决
SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup
ORACLE 例程已经启动。

Total System Global Area 3675756336 bytes
Fixed Size                   735024 bytes
Variable Size            2835349504 bytes
Database Buffers          838860800 bytes
Redo Buffers                 811008 bytes
数据库装载完毕。
数据库已经打开。
查看命中率\当前只有80的满足要求
SQL> select size_for_estimate, buffers_for_estimate ,ESTD_PHYSICAL_READ_factor,ESTD_PHYSICAL_READS from v$db_cache_advice
  2      where block_size='8192' and advice_status='ON';

SIZE_FOR_ESTIMATE BUFFERS_FOR_ESTIMATE ESTD_PHYSICAL_READ_FACTOR ESTD_PHYSICAL_READS
----------------- -------------------- ------------------------- -------------------
               80                 9925                         1                1528
              160                19850                         1                1528
              240                29775                         1                1528
              320                39700                         1                1528
              400                49625                         1                1528
              480                59550                         1                1528
              560                69475                         1                1528
              640                79400                         1                1528
              720                89325                         1                1528
              800                99250                         1                1528
              880               109175                         1                1528

SIZE_FOR_ESTIMATE BUFFERS_FOR_ESTIMATE ESTD_PHYSICAL_READ_FACTOR ESTD_PHYSICAL_READS
----------------- -------------------- ------------------------- -------------------
              960               119100                         1                1528
             1040               129025                         1                1528
             1120               138950                         1                1528
             1200               148875                         1                1528
             1280               158800                         1                1528
             1360               168725                         1                1528
             1440               178650                         1                1528
             1520               188575                         1                1528
             1600               198500                         1                1528
命中率降低了?        
    SQL> select 1 - ((physical.value - direct.value - lobs.value) / logical.value)
  2       "Buffer Cache Hit Ratio"
  3    from v$sysstat physical,v$sysstat direct,v$sysstat lobs,v$sysstat logical
  4    where physical.name = 'physical reads'
  5    and direct.name='physical reads direct'
  6    and lobs.name='physical reads direct (lob)'
  7    and logical.name='session logical reads';

Buffer Cache Hit Ratio
----------------------
            .906673167

继续缩小SGA大小
SQL>alter system set SGA_MAX_SIZE=3000M scope=spfile;

SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup
ORACLE 例程已经启动。

Total System Global Area 3155661888 bytes
Fixed Size                   734272 bytes
Variable Size            2315255808 bytes
Database Buffers          838860800 bytes
Redo Buffers                 811008 bytes
数据库装载完毕。
数据库已经打开。
select size_for_estimate, buffers_for_estimate ,ESTD_PHYSICAL_READ_factor,ESTD_PHYSICAL_READS from v$db_cache_advice 
    where block_size='8192' and advice_status='ON';

继续测试:等待30分钟之后测试
    SQL> alter system set db_cache_size=1120M;
   
    select 1 - ((physical.value - direct.value - lobs.value) / logical.value)
     "Buffer Cache Hit Ratio"
  from v$sysstat physical,v$sysstat direct,v$sysstat lobs,v$sysstat logical
  where physical.name = 'physical reads'
  and direct.name='physical reads direct'
  and lobs.name='physical reads direct (lob)'
  and logical.name='session logical reads';
  ---命中率逐渐的提高了
  ---半个小时之后查询命中率是98%
  SQL> select 1 - ((physical.value - direct.value - lobs.value) / logical.value)
  2       "Buffer Cache Hit Ratio"
  3    from v$sysstat physical,v$sysstat direct,v$sysstat lobs,v$sysstat logical
  4    where physical.name = 'physical reads'
  5    and direct.name='physical reads direct'
  6    and lobs.name='physical reads direct (lob)'
  7    and logical.name='session logical reads';

Buffer Cache Hit Ratio
----------------------
            .980309028
-----查询推荐的值
show parameter db_block_size
8192

select name,size_for_estimate,v$db_cache_advice.ESTD_PHYSICAL_READS from
v$db_cache_advice  where block_size='8192' and advice_status='ON';

NAME                 SIZE_FOR_ESTIMATE ESTD_PHYSICAL_READS
-------------------- ----------------- -------------------
DEFAULT                            112                9581
DEFAULT                            224                9514
DEFAULT                            336                9514
DEFAULT                            448                9514
DEFAULT                            560                9514
DEFAULT                            672                9514
DEFAULT                            784                9514
DEFAULT                            896                9514
DEFAULT                           1008                9514
DEFAULT                           1120                9514
DEFAULT                           1232                9514

NAME                 SIZE_FOR_ESTIMATE ESTD_PHYSICAL_READS
-------------------- ----------------- -------------------
DEFAULT                           1344                9514
DEFAULT                           1456                9514
DEFAULT                           1568                9514
DEFAULT                           1680                9514
DEFAULT                           1792                9514
DEFAULT                           1904                9514
DEFAULT                           2016                9514
DEFAULT                           2128                9514
DEFAULT                           2240                9514
显示只要112M大小的空间就可以稳定降低ESTD_PHYSICAL_READS
alter system set db_cache_size=112M
NAME                 SIZE_FOR_ESTIMATE ESTD_PHYSICAL_READS
-------------------- ----------------- -------------------
DEFAULT                             16                   0
DEFAULT                             32                   0
DEFAULT                             48                   0
DEFAULT                             64                   0
DEFAULT                             80                   0
DEFAULT                             96                   0
DEFAULT                            112                   0
DEFAULT                            128                   0
DEFAULT                            144                   0
DEFAULT                            160                   0
DEFAULT                            176                   0

NAME                 SIZE_FOR_ESTIMATE ESTD_PHYSICAL_READS
-------------------- ----------------- -------------------
DEFAULT                            192                   0
DEFAULT                            208                   0
DEFAULT                            224                   0
DEFAULT                            240                   0
DEFAULT                            256                   0
DEFAULT                            272                   0
DEFAULT                            288                   0
DEFAULT                            304                   0
DEFAULT                            320                   0
---查看命中率
  select 1 - ((physical.value - direct.value - lobs.value) / logical.value)
     "Buffer Cache Hit Ratio"
  from v$sysstat physical,v$sysstat direct,v$sysstat lobs,v$sysstat logical
  where physical.name = 'physical reads'
  and direct.name='physical reads direct'
  and lobs.name='physical reads direct (lob)'
  and logical.name='session logical reads';

Buffer Cache Hit Ratio
----------------------
            .982795739
说明Oracle更换峰值的情况决定db_cache_size的大小。
所以设置最大峰值满足的情况。
alter system set db_cache_size=1120M;满足峰值的时候最大值
select name,size_for_estimate,v$db_cache_advice.ESTD_PHYSICAL_READS from
v$db_cache_advice  where block_size='8192' and advice_status='ON';

oracle10g Solaris 10 sparc系统调整

--查
  select name,size_for_estimate,v$db_cache_advice.ESTD_PHYSICAL_READS from
v$db_cache_advice  where block_size='8192' and advice_status='ON';

-------------------- ----------------- -------------------
DEFAULT                            128             1206647
DEFAULT                            256             1067789
DEFAULT                            384              987752
DEFAULT                            512              965164
DEFAULT                            640              913815
DEFAULT                            768              893485
DEFAULT                            896              867321
DEFAULT                           1024              808884
DEFAULT                           1152              599909
DEFAULT                           1280              344618
--此时开始保持在一个稳定的读取值
alter system set db_cache_size=1196M

DEFAULT                           1296              321763

NAME                 SIZE_FOR_ESTIMATE ESTD_PHYSICAL_READS
-------------------- ----------------- -------------------
DEFAULT                           1408              285030
DEFAULT                           1536              280506
DEFAULT                           1664              280325
DEFAULT                           1792              279816
DEFAULT                           1920              266871
DEFAULT                           2048              235838
DEFAULT                           2176              231298
DEFAULT                           2304              228483
DEFAULT                           2432              224971
DEFAULT                           2560              219467
--修改
alter system set db_cache_size=1196M
--查看命中率
  select 1 - ((physical.value - direct.value - lobs.value) / logical.value)
     "Buffer Cache Hit Ratio"
  from v$sysstat physical,v$sysstat direct,v$sysstat lobs,v$sysstat logical
  where physical.name = 'physical reads'
  and direct.name='physical reads direct'
  and lobs.name='physical reads direct (lob)'
  and logical.name='session logical reads';

Oracle优化 -- 关于Database Buffer Cache相关参数DB_CACHE_SIZE的优化设置的更多相关文章

  1. 深入浅出Oracle学习笔记:Buffer Cache 和Shared pool

    Buffer cache 和 share pool 是sga中最重要最复杂的部分. 一.Buffer Cache 通常数据的读取.修改都是通过buffer cache 来完成的.buffer cach ...

  2. Oracle调优之buffer pool相关

    一个oracle block与data buffer中的一个buffer对应.用户进程(server process)负责读取磁盘上的block到data buffer cache中,DEWn进程负责 ...

  3. ORACLE性能优化- Buffer cache 的调整与优化

    Buffer Cache是SGA的重要组成部分,主要用于缓存数据块,其大小也直接影响系统的性能.当Buffer Cache过小的时候,将会造成更多的 free buffer waits事件. 下面将具 ...

  4. Buffer cache 的调整与优化

    Buffer cache 的调整与优化 -============================== -- Buffer cache 的调整与优化(一) --==================== ...

  5. [转载]Buffer cache的调整与优化

    Buffer Cache是SGA的重要组成部分,主要用于缓存数据块,其大小也直接影响系统的性能.当Buffer Cache过小的时候,将会造成更多的free buffer waits事件.下面将具体描 ...

  6. Multiple Database Block Sizes and the Buffer Cache

    In oracle 10g we can have multiple block sizes at the same time. When a tablespace is created we can ...

  7. MapReduce 基本优化相关参数

    MapReduce优化优化(1)资源相关参数:以下参数是在自己的 MapReduce 应用程序中配置就可以生效 mapreduce.map.memory.mb: 一个 Map Task 可使用的内存上 ...

  8. buffer cache 深度解析

    本文首先详细介绍了oracle中buffer cache的概念以及所包含的内存结构.然后结合各个后台进程(包括DBWRn.CKPT.LGWR等)深入介绍了oracle对于buffer cache的管理 ...

  9. buffer cache —— buffer busy waits/read by other session

    oracle提供非常精确.有效的row level lock机制,多个用户同时修改数据时,为了保护数据,以块为单位挂起锁的情况不会发生.但这不太正确.以块为单位的锁虽然不存在,但正因为oracle I ...

随机推荐

  1. VQuery选择器

    VQUery elements属性,储存选中的元素 参数 typeof的作用 字符串 class  ID tagName 函数 事件绑定 对象 直接插入 $函数 绑定事件 click方法 显示隐藏,- ...

  2. 【GoLang】并发小结

    006.并发 1 概念 1.1 goroutine是Go并行设计的核心,goroutine的本质是轻量级线程 1.2 golang的runtime实现了对轻量级线程即goroutine的智能调度管理 ...

  3. Sum of Left Leaves

    Find the sum of all left leaves in a given binary tree. Example: 3 / \ 9 20 / \ 15 7 There are two l ...

  4. LINQ查询数组里面是否包含某值

    #region linq to 数组            //定义数组,并初始化            string [] array = new string []{"Juan" ...

  5. 【leetcode】Maximum Subarray

    Maximum Subarray Find the contiguous subarray within an array (containing at least one number) which ...

  6. poj 1511(spfa)

    ---恢复内容开始--- http://poj.org/problem?id=1511 一个spfa类的模板水题. 题意:就是求从1到n个点的来回的所有距离和. 对spfa类的题还是不太熟练,感觉还是 ...

  7. cf555b

    题意:按顺序给出多个互不相交的区间(表示一些小岛),和一些可以连接区间的桥,每个桥有固定的长度.区间和桥的数量都是2*10^5. 两个相邻的小岛之间的桥的长度必须小于等于最远点距离,大于等于最近点距离 ...

  8. [Linux]centOS7-1-1503-x86_64下安装VM-TOOLS

    1.安装Perl. 2.如果提示 The path "" is not a valid path to the 3.10.0-229.el7.x86_64 kernel heade ...

  9. FastReport 使用技巧篇

    使用技巧篇 1.FastReport中如果访问报表中的对象?       可以使用FindObject方法.      TfrxMemoView(frxReport1.FindObject('memo ...

  10. Java中的try,catch(Exception e),finally及return执行顺序

    结论: ①就算之前return,finally也会执行 ②finally的计算结果不影响之前的return值 ③finally的return值一定是最后的返回结果,因此将return放入finally ...