DB_CACHE_SIZE

In Oracle Database,the db_cache_size and db_nk_cache_size parameters determine the size of Database Buffer Cache.

Default value If SGA_TARGET is set: If the parameter is not specified, then the default
is 0 (internally determined by the Oracle Database). If the parameter is
specified, then the user-specified value indicates a minimum value for
the memory pool.
If SGA_TARGET is not set, then the default is either 48 MB or 4MB *
number of CPUs * granule size, whichever is greater

Default value of the db_cache-size :If SGA_TARGET is set: If the parameter is not specified, then the default is 0 (internally determined by the Oracle Database). If the parameter is specified, then the user-specified value indicates a minimum value for the memory pool.

If SGA_TARGET is not set, then the default is either 48 MB or 4MB * number of CPUs * granule size, whichever is greater.

DB_CACHE_SIZE specifies the size of the DEFAULT buffer pool for buffers with the primary block size (the block size defined by the DB_BLOCK_SIZE initialization parameter).

The value must be at least 4M * number of cpus * granule size (smaller values are automatically rounded up to this value). A user-specified value larger than this is rounded up to the nearest granule size. A value of zero is illegal because it is needed for the DEFAULT memory pool of the primary block size, which is the block size for the SYSTEM tablespace.

————–Derived From Oracle 10g References——————–

DB_CACHE_SIZE 数据缓冲区

SQL> select * from v$version where rownum<=1;
BANNER
—————————————————————-
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 – 64bi
SQL> show parameter db_cache
NAME                                 TYPE        VALUE
———————————— ———– ——————————
db_cache_advice                      string      ON
db_cache_size                        big integer 0

data buffers
8i中是Db_block_buffers(数据块缓冲缓存区Data block buffers cache)*Db_block_size,
9i及以后版本用Db_cache_size来代替这个参数。
10g中,由oracle本身自动管理的,可以不用手工设置。

在内存的配置中把其他参数设置完后,应把能给的都给Data buffers。Oracle在运行期间向数据库高速缓存读写数据,高速缓存命中表示信息已在内存中,高速缓存失败意味着

Oracle必需进行磁盘I/O。保持高速缓存失败率最小的关键是确保高速缓存的大小。Oracle8i中初始化参数Db_block_buffers控制数据库缓冲区高速缓存的大小。

通过查询V$sysstat表,求出命中率,以确定是否应当增加Db_block_buffers的值。
高速缓存命中率=1-physical   reads/(dbblock   gets+consistent   gets)
select 1 – (select value from v$sysstat where name = ‘physical reads’) /
((select value from v$sysstat where name = ‘consistent gets’) +
(select value from v$sysstat where name = ‘db block gets’)) ratio
from dual;
如果该命中率太小,考虑增大数据库缓冲区。

–原始数据查询
SQL> 1  select name,value
2  from v$sysstat
3* where name in (’db block gets’,'consistent gets’,'physical reads’)
SQL> /

NAME                                                                  VALUE
—————————————————————- ———-
db block gets                                                      49148660
consistent gets                                                  4223352513
physical reads                                                     51914221

–命中率查询
SQL> select 1 – (select value from v$sysstat where name = ‘physical reads’) /
2         ((select value from v$sysstat where name = ’consistent gets’) +
3         (select value from v$sysstat where name = ’db block gets’)) ratio
4    from dual;

RATIO
———-
.987851628

Oracle 10g中,与内存相关的参数可以分为两类:
自动调优的SGA参数:包括DB_CACHE_SIZE、SHARED_POOL_SIZE、LARGE_POOL_SIZE和JAVA_POOL_SIZE。
手动SGA参数:包括LOG_BUFFER、STREAMS_POOL、DB_NK_CACHE_SIZE、DB_KEEP_CACHE_SIZE和DB_RECYCLE_CACHE_SIZE。

SQL> show parameter cache_size
NAME                                 TYPE        VALUE
———————————— ———– ——————————
db_16k_cache_size                    big integer 0
db_2k_cache_size                     big integer 0
db_32k_cache_size                    big integer 0
db_4k_cache_size                     big integer 0
db_8k_cache_size                     big integer 0
db_cache_size                        big integer 0
db_keep_cache_size                   big integer 0
db_recycle_cache_size                big integer 0
SQL> show parameter pool
NAME                                 TYPE        VALUE
———————————— ———– ——————————
buffer_pool_keep                     string
buffer_pool_recycle                  string
global_context_pool_size             string
java_pool_size                       big integer 0
large_pool_size                      big integer 0
olap_page_pool_size                  big integer 0
shared_pool_reserved_size            big integer 47815065
shared_pool_size                     big integer 0
streams_pool_size                    big integer 0

Oracle 10g中,任何时候你都能查询V$SGAINFO,来查看SGA的哪些组件的大小可以调整。
使用自动SGA内存管理,参数STATISTICS_LEVEL必须设置为TYPICAL或ALL。如果不支持统计集合,数据库就没有足够的历史信息来确定大小。采用自动SGA内存管理时,确定自动

调整组件大小的主要参数是SGA_TARGET,该参数在数据库运行时动态调整,最大可以达到SGA_MAX_SIZE参数设置的值(默认等于SGA_TARGET,所以如果想增加SGA_TARGET,就必须在

启动数据库实例之前先把SGA_MAX_SIZE设置得大一些)。
数据库会使用SGA_TARGET值,再减去其他手动设置组件的大小(如DB_KEEP_CACHE_SIZE、DB_RECYCLE_CACHE_SIZE),使用计算得到的内存量来设置默认缓冲区池、共享池、大池和

Java池的大小。在运行时,实例会根据需要动态地对这4个内存区分配和撤销内存。如果共享池内存用光了,实例不会向用户返回一个ORA-04031″Unable to allocate N bytes of

shared memory”错误,而是会把缓冲区缓存缩小几MB(一个granule的大小),再相应地增加共享池的大小。
–Granule的大小查询
SQL> select name,bytes from v$sgainfo where name =’Granule Size’;
NAME                                  BYTES
——————————– ———-
Granule Size                       16777216
SQL> select bytes/1024/1024/8 from v$sgainfo where name =’Granule Size’;
BYTES/1024/1024/8
—————–
2
SQL> show parameter db_block_size
NAME                                 TYPE        VALUE
———————————— ———– ——————————
db_block_size                        integer     8192

也就是2048个db_block_size为一个Granule

SQL> show parameter statistics_level
NAME                                 TYPE        VALUE
———————————— ———– ——————————
statistics_level                     string      TYPICAL
SQL> show parameter sga_target
NAME                                 TYPE        VALUE
———————————— ———– ——————————
sga_target                           big integer 1536M
SQL> show parameter sga_max_size
NAME                                 TYPE        VALUE
———————————— ———– ——————————
sga_max_size                         big integer 1536M

V$sysstat

SQL> desc V$sysstat
Name       Type         Nullable Default Comments
———- ———— ——– ——- ——–
STATISTIC# NUMBER       Y
NAME       VARCHAR2(64) Y
CLASS      NUMBER       Y
VALUE      NUMBER       Y
STAT_ID    NUMBER       Y

v$sgainfo

SQL> desc v$sgainfo
名称                                      是否为空? 类型
—————————————– ——– —————–
NAME                                               VARCHAR2(32)
BYTES                                              NUMBER
RESIZEABLE                                         VARCHAR2(3)

SQL> select * from v$sgainfo;
NAME                                  BYTES RES
——————————– ———- —
Fixed SGA Size                      2128760 No
Redo Buffers                        4325376 No
Buffer Cache Size                 721420288 Yes
Shared Pool Size                  838860800 Yes
Large Pool Size                    16777216 Yes
Java Pool Size                     16777216 Yes
Streams Pool Size                         0 Yes
Granule Size                       16777216 No
Maximum SGA Size                 1610612736 No
Startup overhead in Shared Pool    67108864 No
Startup NUMA Shared Pool memory    33554432 No
Free SGA Memory Available                 0

已选择12行。

———–Derived From http://my.unix-center.net/~Zianed/?p=477————

Send article as PDF to PDF

25 comments

  1. 右脑学习 says:

    学习了!谢谢分享!

  2. 网上赚钱 says:

    不错,过来顶一下 ^_^

  3. Usually I do not post on blogs, but I would like to say that this article really forced me to do so! Thanks, really nice article.

  4. This is a good,common sense article.Very helpful to one who is just finding the resouces about this part.It will certainly help educate me.

  5. Hey great blog, just looking around some blogs, seems a really nice platform you are using. I’m currently using WordPress for a few of my blogs but looking to change one of them over to a platform similar to yours as a trial run. Anything in particular you would recommend about it?

  6. Thank you! I really appreciate your article, in fact I think you deserve a thumbs up.

  7. Amazing, I found your site on google poking around for something completely unrelated- now I’m gonna need to go the old posts. Good bye free time today, but this was a really spectacular find.

  8. Hi administrator I take pleasure fromI like what you all have to say. Very straight to the point.

  9. Need to subscribe to this blog, great post. Found it on bing.

  10. great article, i just finished bookmarking it to regularly check it. i’d love to revisit on new articles. how do i set the RSS again? thanks!

  11. Having been simply browsing for relevant blog posts with regard to our project research when I happened to stumble on yours. Thanks for the practical information!

  12. hey there I just wanted to comment your blog and say that I really enjoyed reading your blog post here. It was very informative and I also digg the way you write! Keep it up and I’ll be back to read more soon mate

  13. I just wanted to comment your blog and say that I really enjoyed reading your blog post here. It was very informative and I also digg the way you write! Keep it up and I’ll be back to read more soon mate

  14. You certainly deserve a round of applause for your post and more specifically, your blog in general. Very high quality material.

  15. Saved your site. Appreciation for discussing. Surely well worth time clear of my personal tests.

  16. Very useful informations about these subject. I have found them with googling and you seems number one of these subjects ! . . .

  17. Printing and Mailing is a great way of marketing all around even in this internet savvy world. I recently started a new business and got great response from postcard mailing services.

  18. This is positively one of the most remarkable blogs I’ve seen. It’s so easy to tune out, but there is seriously some first-rate material online, and I believe your place is one of the few!

  19. Random question: I am starting my own blog to share my photography experiences. Do you find it hard or easy to post consistently?

  20. Sorry for the huge review, but I’m really loving the new Zune, and hope this, as well as the excellent reviews some other people have written, will help you decide if it’s the right choice for you.

  21. Hey this is a great post. I’m going to email this to my friends. I stumbled on this while surfing for some lyrics, I’ll be sure to visit regularly. thanks for sharing.

  22. I just visited your website via Facebook..

  23. Why this web site do not have other languages support?

  24. By far the most concise and up to date information I found on this topic. Sure glad that I navigated to your page by accident. I’ll be subscribing to your feed so that I can get the latest updates. Appreciate all the information here

  25. Please tell me it worked right? I dont desire to sumit it again if i do not have to! Either the blog glitced out or i am an idiot, the second choice doesnt surprise me lol. thanks to your beneficial blog!

Leave a Reply

Spam Protection by WP-SpamFree