Memory Architecture   «Prev 

Database buffer cache

Oracle database buffer cache
  1. Blue buffers 1,3,4,8: Dirty buffer
  2. Blue buffer 6: Will be moved to the dirty list
  3. Green buffer 5: The least recently used buffer
  4. Green buffer 7: The most recently used buffer
  5. Green buffer 2: The third most recently used buffer
  6. Dirty List 1,3,4,8: Pointers to the dirty buffers
  7. LRU List 5: Pointer to the least recently used buffer
  8. LRU List 7: Pointer to the most recently used buffer
  9. LRU List 2: Pointer to the third most recently used buffer
  10. LRU List 6: Pointer to the second most recently used buffer

Database Buffer Cache

The database buffer cache is an area in the SGA used to hold the data blocks that are read from the data segments in the database, such as tables and indexes. The size of the database buffer cache is determined by the DB_CACHE_SIZE parameter (expressed in terms of number of bytes) in the initialization parameter file for the database. The default size for the database blocks is set via the DB_BLOCK_SIZE parameter specified in the parameter file during database creation. Managing the size of the database buffer cache is an important part of managing and tuning the database. The database has a default block size, but you can establish cache areas for different database block sizes and then create tablespaces to use those caches. For example, you can create a 4KB block size database with some tablespaces set to 8KB. The size of the 8KB cache would be set via the DB_8K_CACHE_SIZE parameter. To create tablespaces to use that cache, specify blocksize 8K as part of the create tablespace command. If the default block size for the database is 4KB, you would not set a value for DB_4K_CACHE_SIZE; the size specified for DB_CACHE_SIZE would be used for the 4KB cache.

Note: The cache for the block size must exist before you create a tablespace that uses that block size.
The different cache areas can be resized while the database is running. Caches can only be made larger if unallocated memory is available. The caches must be increased or decreased in granules. For a database with an SGA less than 128M, the granule size is 4M—so DB_8K_CACHE_SIZE can be 4M, 8M, 12M, and so on.
If you attempt to use any other setting, Oracle will round it up to the next granule size. The following listing shows the setting of the DB_8K_CACHE_SIZE parameter. To see if memory is available, query the V$SGA_DYNAMIC_FREE_MEMORY view.
alter system set DB_8K_CACHE_SIZE = 8m;

If you create a tablespace that uses a nondefault database block size, you must be sure that the related cache size parameter (such as DB_8K_CACHE_SIZE) is updated in your database parameter file. If you are using an init.ora file, you must update it with the new value. If you are using a system parameter file (the preferred method), it will be automatically updated when you execute the alter system command with the scope=both clause.