AWS Oracle DB Memory Utilisation in Ec2 Instance | Automatic Memory Management


Dear Readers, 

Recently I was tagged with a task to optimise the memory used by the Oracle DB in AWS Ec2 instance. 

Issue: Whenever Oracle DB version 11 edition is started on the Ec2 instance it takes up all the memory in the instance and crashes. 

Approach:

We tried to increase the memory of the instance and finally the DB was working while the instance memory was at around 128GB (the size is not exact). 

In search of the solution I've gone through few documents and understood that latest version of the Oracle DB have the feature called Automatic Memory Management (AMM). This feature helps to manage and remove few manual memory management job which was done previously. However, we have to control two factors in the configuration to control the AMM feature otherwise we will face the issue mentioned above. Other solution will be to disable the feature in the Oracle DB but this will make way for manual configuration management of few memory parameters in the oracle. 

Solution:

The solution I followed was to add the  memory_target and memory_max_target, this way we can control the AMM and set a boundary on how much memory of the Ec2 instance will be taken as reserved for the Oracle DB. 


Login to the AWS Oracle DB instance 

switch to the directory 

 # cd /u01/app/oracle/admin/ctcweb10/pfile/

Here we can see a  configuration file, please take the backup of the same. 

Edit the file 

vi /u01/app/oracle/admin/ctcweb10/pfile/random.pfile

Add the following entries to the file 

memory_target = 1G

memory_max_target = 3G

These values can be adjusted as per our requirements. 

Once this is done. 

switch to the oracle db user

# su - oracle

$ lsnrctl start

$ sqlplus / as sysdba

SQL> startup pfile=/u01/app/oracle/admin/ctcweb10/pfile/random.pfile

This will start the DB with our configuration. 

If everything is working fine , make the change permanent by creating the spfile

SQL> CREATE SPFILE FROM PFILE='/u01/app/oracle/admin/ctcweb10/pfile/random.pfile';

File created

Once this is done you can shutdown and start the DB without any file pointing. 

Shutdown Oracle DB

# su - oracle

$ sqlplus / as sysdba

SQL> shutdown immediate

Start the DB 

# su - oracle

$ lsnrctl start

$ sqlplus / as sysdba

SQL>  startup open



Comments