Monday, January 21, 2013

what is granules in sga ?

With the dynamic SGA infrastructure, the size of the buffer cache, the shared pool, the large pool, and the process-private memory can be changed without shutting down the instance.With dynamic SGA, the unit of allocation is called a granule
Granules are introduced in oracle 9.0.1 . Components, such as the buffer cache, the shared pool, the java pool, and the large pool, allocate and deallocate space in units of granules . Oracle tracks SGA memory use in integral numbers of granules, by SGA component. For example,

If you specify a size for a component that is not a multiple of granule size, then Oracle rounds the specified size up to the nearest multiple. For example, if the granule size is 4 MB and you specify DB_CACHE_SIZE as 10 MB, you will actually be allocated 12 MB.


Granule size is determined by total SGA size. On most platforms, the size of a granule is 4 MB if the total SGA size is less than 128 MB, and it is 16 MB for larger SGAs. There may be some platform dependency, for example, on 32-bit Windows NT, the granule size is 8 MB for SGAs larger than 128 MB.



The granule size that is currently being used for SGA can be viewed in the view V$SGA_DYNAMIC_COMPONENTS. The same granule size is used for all dynamic components in the SGA. We can also retrieve information from v$sgainfo from oracle 10.1 onwards

SQL>select COMPONENT,GRANULE_SIZE from V$SGA_DYNAMIC_COMPONENTS;

COMPONENT                      GRANULE_SIZE
------------------------------ ------------
shared pool                        16777216
large pool                         16777216
java pool                          16777216
streams pool                       16777216
DEFAULT buffer cache               16777216
KEEP buffer cache                  16777216
RECYCLE buffer cache               16777216
DEFAULT 2K buffer cache            16777216
DEFAULT 4K buffer cache            16777216
DEFAULT 8K buffer cache            16777216
DEFAULT 16K buffer cache           16777216
DEFAULT 32K buffer cache           16777216
ASM Buffer Cache                   16777216

13 rows selected .

Here granule_size is taken as 16MB.

Adding Granules to Components
A database administrator grows a component's SGA use with ALTER SYSTEM statements to modify the initialization parameter values. Oracle takes the new size, rounds it up to the nearest multiple of 16MB, and adds or takes away granules to meet the target size. Oracle must have enough free granules to satisfy the request. If the current amount of SGA memory is less than SGA_MAX_SIZE, then Oracle can allocate more granules until the SGA size reaches SGA_MAX_SIZE.

The minimum SGA size is three granules, based on:

  1. One Granule for Fixed SGA (includes redo buffers)
  2. One Granule for Buffer Cache
  3. One Granule for the Shared Pool

Following pools can be dynamically resized , 

Stream pools can not dynamically resized  in 10.1 

No comments:

Post a Comment