With dynamic SGA, the unit of allocation is called a granule. Components,
such as the buffer cache, the shared pool, the java pool, and the large
pool, allocate and free SGA space in units of granules. Oracle tracks
SGA memory use in integral numbers of granules, by SGA component. All
information about a granule is stored in a corresponding granule entry. Oracle maintains the state of each granule in the granule entry and the granule type.
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.
Note:
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.
|
Oracle keeps information about the components and their granules in a scoreboard.
For each component that owns granules, the scoreboard contains the
number of granules allocated to the component, any pending operations
against this component, the target size in granules, and the progress
made toward the target size. The start time of the operation is also
logged. Oracle maintains the initial number of granules and the maximum
number of granules for each component.
For operations that modify the number of granules, Oracle
logs the operation, the target size, and the start time to the
appropriate SGA component in the scoreboard. Oracle updates the
progress field until the operation is complete. When the operation is
complete, Oracle replaces the current size with the target size and
clears the target size field and the progress field. At the end of the
operation, a database administrator can see how the number of granules
was changed. Oracle updates the initialization parameter values to
reflect the updated amount of SGA in use.
Oracle maintains a circular buffer of the last 100
operations made to the scoreboard. Fixed views show the state of the
scoreboard and the current contents of last 100 operations to the
scoreboard.
Allocating Granules at Startup
At startup, Oracle reads the values in the initialization
parameter file, queries the operating system memory limits, and
allocates virtual address space for the SGA. The initialization
parameter SGA_MAX_SIZE
specifies the maximum size of the SGA for the life of the instance in bytes. Its value is rounded up to the next granule size.
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
.