Automatic Shared Memory Management(ASMM)

1.base:
  1) In Oracle 10g, you need to specify only the SGA_TARGET parameter, which specifies the total size of the SGA. Individual components of the SGA are automatically allocated by the database based on the workload and history information.

  2) The new parameter SGA_TARGET is the size of total SGA, which includes the automatically sized components, manually sized components, and any internal allocations during instance startup.

2.enabling and disabling ASSM
  1) ASMM is enabled when the STATISTICS_LEVEL parameter is set to TYPICAL or ALL and the SGA_TARGET parameter is set to a nonzero value. When enabled, ASMM distributes memory appropriately for the following memory areas: DB_CACHE_SIZE、SHARED_POOL_SIZE、LARGE_POOL_SIZE、JAVA_POOL_SIZE
  2) The following areas should be manually configured and are not affected by ASMM:LOG_BUFFER、DB_KEEP_CACHE_SIZE、DB_RECYCLE_CACHE_SIZE、DB_nK_CACHE_SIZE、STREAMS_POOL_SIZE、Fixed-SGA area and internal allocations
  3) The SGA_TARGET parameter is dynamic and can be resized using the ALTER SYSTEM statement.The value of SGA_TARGET cannot be higher than the SGA_MAX_SIZE parameter, which is not dynamically changeable. Reducing the size of SGA_TARGET affects only the autotuned components of the SGA. SGA_TARGET can be reduced until one of the autotuned components reaches its minimum size (a user-specified or Oracle-determined minimum).
  4)You can query the current sizes of the SGA components using the V$SGA_DYNAMIC_
COMPONENTS dictionary view, like so:
  SQL> select COMPONENT,CURRENT_SIZE,MIN_SIZE,MAX_SIZE from v$sga_dynamic_components;

COMPONENT                  CURRENT_SIZE   MIN_SIZE   MAX_SIZE
-------------------------- ------------ ---------- ----------
shared pool                    71303168   62914560          0
large pool                      4194304    4194304          0
java pool                       4194304    4194304          0
streams pool                          0          0          0
DEFAULT buffer cache          125829120  125829120          0
KEEP buffer cache                     0          0          0
RECYCLE buffer cache                  0          0          0
DEFAULT 2K buffer cache               0          0          0
DEFAULT 4K buffer cache               0          0          0
DEFAULT 8K buffer cache               0          0          0
DEFAULT 16K buffer cache              0          0          0
DEFAULT 32K buffer cache              0          0          0
ASM Buffer Cache                      0          0          0

13 rows selected

  5)When SGA_TARGET is set to a nonzero value, the autotuned SGA parameters will have default values of zero. If you specify a value for the autotuned SGA parameters,the value will be treated as the lower limit of that component.

  6)Resizing the autotuned SGA parameters is possible even if ASMM is enabled. For autotuned parameters, manual resizing will result in immediate component resizing if the current value is smaller than the new value. If the new value is smaller, the component is not resized, but a new minimum size is set.

  7)Setting SGA_TARGET to zero will disable ASMM. The autotuned components will have values of their current sizes, and these values are written to the SPFILE to use for the next instance startup.

  For manually configured SGA parameters, resizing will immediately take effect to the precise new value. If the size of a component is increased, one or more of the autotuned components will be reduced. If the size of a manually configured component is reduced, the memory that is released is given to the automatically sized components.

3.related views
  1)V$SGA_CURRENT_RESIZE_OPS: SGA resize operations that are currently in progress
  2)V$SGA_RESIZE_OPS :Information about the last 400 completed SGA resize  operations
  3)V$SGA_DYNAMIC_COMPONENTS :Information about the dynamic components of the SGA
  4)V$SGA_DYNAMIC_FREE_MEMORY:Information about the amount of SGA memory available for future dynamic SGA resize operations

4.The Memory Manager Process
1) Oracle 10g comes with the new MMAN process (which stands for memory manager) to manage the automatic shared memory. MMAN serves as the SGA memory broker and coordinates the sizing of the memory components. It keeps track of the sizes of the components and pending resize operations.
  2)The MMAN process observes the system and workload to determine the ideal distribution of memory. MMAN performs this check every few minutes so that memory can always be present where needed. When SPFILE is used, component sizes are used from the last shutdown.

5.示例

1)查询当前的设置

SQL> Select component,current_size,min_size,user_specified_size From v$sga_dynamic_components;

COMPONENT                 CURRENT_SIZE   MIN_SIZE USER_SPECIFIED_SIZE
------------------------- ------------ ---------- -------------------
shared pool                  113246208  109051904                   0
large pool                     4194304    4194304                   0
java pool                      4194304    4194304                   0
streams pool                         0          0                   0
DEFAULT buffer cache          41943040   37748736                   0
KEEP buffer cache                    0          0                   0
RECYCLE buffer cache                 0          0                   0
DEFAULT 2K buffer cache              0          0                   0
DEFAULT 4K buffer cache              0          0                   0
DEFAULT 8K buffer cache              0          0                   0
DEFAULT 16K buffer cache             0          0                   0
DEFAULT 32K buffer cache             0          0                   0
ASM Buffer Cache                     0          0                   0


SQL> select name,value from v$parameter where name in
('statistics_level','sga_target','db_cache_size','shared_pool_size','large_pool_size','java_pool_size','sga_max_size');

NAME               VALUE
------------------ -----------
sga_max_size       167772160
shared_pool_size   0
large_pool_size    0
java_pool_size     0
sga_target         171966464
db_cache_size      0
statistics_level   TYPICAL

7 rows selected

说明:

a.当前属于enable ASMM,sga_target=164M,其它参数均为0(USER_SPECIFIED_SIZE)

b.当前各个组件的大小从v$sga_dynamic_components中的current_size可以看出

2)disable assm

#取消assm

SQL> alter system set sga_target=0;

System altered

#查询视图,发现oracle根据之前的current_size自动设置了shared_pool_size、db_cache_size等几个参数。

SQL> Select component,current_size,min_size,user_specified_size From v$sga_dynamic_components;

COMPONENT                CURRENT_SIZE   MIN_SIZE USER_SPECIFIED_SIZE
------------------------ ------------ ---------- -------------------
shared pool                 113246208  109051904           113246208
large pool                    4194304    4194304             4194304
java pool                     4194304    4194304             4194304
streams pool                        0          0                   0
DEFAULT buffer cache         41943040   37748736            41943040
KEEP buffer cache                   0          0                   0
RECYCLE buffer cache                0          0                   0
DEFAULT 2K buffer cache             0          0                   0
DEFAULT 4K buffer cache             0          0                   0
DEFAULT 8K buffer cache             0          0                   0
DEFAULT 16K buffer cache            0          0                   0
DEFAULT 32K buffer cache            0          0                   0
ASM Buffer Cache                    0          0                   0

13 rows selected

SQL> select name,value from v$parameter
where name in ('statistics_level','sga_target','db_cache_size','shared_pool_size','large_pool_size','java_pool_size','sga_max_size');

NAME               VALUE   
------------------ ----------
sga_max_size       167772160
shared_pool_size   113246208
large_pool_size    4194304
java_pool_size     4194304
sga_target         0
db_cache_size      41943040
statistics_level   TYPICAL

7 rows selected

你可能感兴趣的:(oracle,sql,cache)