jeudi 25 août 2011

Oracle 11g : AMM & ASMM

AMM - Automatic Memory Management
AMM allows the dba to define precisely the global use of memory for the entire database.
This memory allocation is divided between the SGA component and all PGA components. This memory distribution is done automatically by the database memory size advisor.
There is 2 parameters to set in order to activate the Automatic Memory Management :
  • MEMORY_TARGET : Minumum memory we wish to allow for SGA and all PGAs
  • MEMORY_MAX_TARGET : Maximum memory that MEMORY_TARGET should not exceed
you enable the automatic memory management by setting only a target memory size initialization parameter (MEMORY_TARGET) and optionally a maximum memory size initialization parameter (MEMORY_MAX_TARGET).

When using automatic memory management, the SGA_TARGET and PGA_AGGREGATE_TARGET act as minimum size settings for their respective memory areas. To allow Oracle to take full control of the memory management, these parameters should be set to zero.

The activation of the AMM implies the activation of ASMM and the activation of the PGA memory advisor.

Remark :
  • If MEMORY_TARGET is set and MEMORY_MAX_TARGET is omitted then MEMORY_MAX_TARGET is set automatically with the value of MEMORY_TARGET.
  • If MEMORY_MAX_TARGET is set and MEMORY_TARGET omitted then MEMORY_TARGET is set to 0. MEMORY_TARGET could be updated dynamicaly using ALTER SYSTEM. After startup, you can then dynamically change MEMORY_TARGET to a nonzero value, provided that it does not exceed the value of MEMORY_MAX_TARGET.
  • We assume commonly that MEMORY_TARGET = SGA_TARGET + PGA_AGGREGATE_TARGET.

Remark : Any modification on these parameters implies the reboot of the entire database. MEMORY_MAX_TARGET is not a dynamic initialization parameter.

ASMM - Automatic Shared Memory Management
ASMM allows the dba to define the memory used by the SGA only.

There is 2 parameters to set in order to activate the Automatic Shared Memory Management :
  • SGA_TARGET : Minumum memory we wish to allow for SGA (not the PGAs)
  • SGA_MAX_SIZE : Maximum memory that SGA_TARGET should not exceed
You enable the automatic shared memory management feature by setting the SGA_TARGET parameter to a nonzero value.
Note:
The STATISTICS_LEVEL initialization parameter must be set to TYPICAL (the default) or ALL for automatic shared memory management to function.

Remark :
  • If SGA_TARGET is set then SGA_MAX_SIZE is set automatically with the value of SGA_TARGET.
  • If SGA_MAX_SIZE is defined then SGA_TARGET is setted by default to 0.
  • SGA_MAX_SIZE is a static parameter. You need to reboot the instance if updated.

Remark :
  • If ASMM is activated then the SGA memory size advisor is activated.
  • If ASMM is activated for the first time then it is not allowed to set a value for the following database parameters in the initialization parameters file:
    • SHARED_POOL_SIZE
    • DB_CACHE_SIZE
    • LARGE_POOL_SIZE
    • JAVA_POOL_SIZE
    • STREAM_POOL_SIZE
  • Setting a value for one component of the SGA when ASMM is activated implies that we want to overload the behaviour the advisor. If the value is less than the value calculated by ASMM then the value is defined as a minimal requirement. If the value is more then the value defined by ASMM then the size of the component is increased to fit the dba requirement. The previous parameter could be altered using ALTER SYSTEM (except for the LOG_BUFFER parameter that is static after instance startup).