What is Automatic Shared Memory Management (ASMM)?
Think of Automatic Shared Memory Management (ASMM) as the "Smart Thermostat" for your Oracle Database's shared memory.
In the old days (before Oracle 10g), a DBA had to manually decide exactly how many megabytes to give to the Data Cache versus the SQL Cache. If you guessed wrong, your performance tanked. ASMM changes the game by letting the database move memory around in real-time based on the actual workload.
SGA_TARGETThe heart of ASMM is a single initialization parameter: SGA_TARGET.
When you set this value (e.g., SGA_TARGET = 10G), you are telling Oracle: "Here is your total budget for the Shared Global Area. You decide how to split it up among your internal components."
Oracle takes control of the five most volatile components of the SGA:
Database Buffer Cache: (The data blocks)
Shared Pool: (The SQL plans and metadata)
Large Pool: (Large allocations like RMAN backups)
Java Pool: (Java-based stored procedures)
Streams Pool: (Data streaming/replication)
ASMM doesn't just "guess"; it uses a background process called MMON (Manageability Monitor) to track memory usage.
If the Database sees that the Shared Pool is running out of space (causing SQL parsing errors), but the Buffer Cache has plenty of idle memory, it performs a trade:
It de-allocates a Granule (a standard unit of memory, e.g., 16MB) from the Buffer Cache.
It immediately re-assigns that Granule to the Shared Pool.
This happens dynamically without a reboot and without kicking users off the system.
You might wonder: "If AMM (MEMORY_TARGET) manages both SGA and PGA, why use ASMM?"
In high-performance enterprise environments, ASMM is often the "Goldilocks" choice for two reasons:
HugePages Support: On Linux, "HugePages" can significantly speed up memory access for large databases. However, Full AMM is usually incompatible with HugePages.
Stability: DBAs often prefer to keep the PGA (user memory) separate so a single "rogue" user running a massive sort doesn't accidentally shrink the entire Database Buffer Cache.
To enable ASMM, you simply need to set the target and ensure the individual parameters are set to zero (which tells Oracle to take over).
Note: Even with ASMM, you can set a minimum value for a component. If you set
DB_CACHE_SIZE = 2GwhileSGA_TARGETis active, Oracle will never let the data cache shrink below 2GB, but it can grow it larger if needed.
You can check by running SELECT component, current_size FROM v$sga_dynamic_components;.