Wednesday, August 15, 2012

Oracle 11g Automatic Memory Management (AMM) size changing.

Oracle 11g introduced new memory management parameters
MEMORY_MAX_TARGET and MEMORY_TARGET .
MEMORY_MAX_TARGET defines maximum size for database memory. And if you need to change it you'll need to restart database instance. And MEMORY_TARGET defines target memory size for database. This can be changed dynamically with no need for restart of instance. But MEMORY_TARGET can't be bigger than MEMORY_MAX_TARGET.
With these parameters set Oracle will automaticly tune PGA and SGA sizes as it needs.
With Linux (RHEL) you need first set tmpfs /dev/shm as big as you wan't to change your MEMORY_MAX_TARGET. And to do this you have to umount /dev/shm first then change it size (do this also in fstab) and then change the parameters in database.  
You can still use old ASMM and other memory management variants with Oracle 11g but usually AMM is good enough.
To change AMM parameters:

Go into the database with sqlplus (as sysdba):
This shows current memory target parameters:
SQL> show parameter target

These changes both AMM parameters:
SQL> alter system set MEMORY_MAX_TARGET = 10G SCOPE = SPFILE;
SQL> alter system set MAX_TARGET = 10G SCOPE = SPFILE;
SQL> shutdown immediate;
With Linux change /dev/shm bigger (read more above) in this step.
SQL> startup
And check that change was succesfull:
SQL> show parameter target

And if you already have big enough MEMORY_MAX_TARGET and you only need to change MAX_TARGET bigger you can do it with this on fly:
SQL> alter system set MAX_TARGET = 10G SCOPE = BOTH;

No comments:

Post a Comment