今天早上看Oracle Concept,第一次接触了Granules这个概念,原以为可以解释这个问题,仔细一算还是对不上。
Dynamic SGA Granules
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. Theremay be some platformdependency, 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.
SQL> column component format a15
SQL> select * from v$sga_dynamic_components;
COMPONENT CURRENT_SIZE MIN_SIZE MAX_SIZE OPER_COUNT LAST_O LAST_O LAST_OPER_TIME GRANULE_SIZE
--------------- ------------ ---------- ---------- ---------- ------ ------ ---------------- ------------
shared pool 58720256 58720256 58720256 0 8388608
large pool 8388608 8388608 8388608 0 8388608
buffer cache 75497472 75497472 75497472 0 8388608
SQL> show parameter shared_pool_size
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
shared_pool_size big integer 58720256
SQL> select sum(bytes) from v$sgastat where pool = 'shared pool';
SUM(BYTES)
----------
75497472
SQL>