Thursday, October 22, 2015

ORA-04031: unable to allocate 56 bytes of shared memory ("shared pool","unknown object","KKSSP^215"

Problem Summary
---------------------------------------------------
ORA-04031: unable to allocate 56 bytes of shared memory ("shared pool","unknown object","KKSSP^215",

<<extract from DB alert log>>
-------------------------------------
ORA-00210: Message 210 not found; No message file for product=RDBMS, facility=ORA
ORA-00202: Message 202 not found; No message file for product=RDBMS, facility=ORA; arguments: [+DATA_DG01/ofsr1/control01.ctl]
ORA-17503: Message 17503 not found; No message file for product=RDBMS, facility=ORA; arguments: [2] [+DATA_DG01/ofsr1/control01.ctl]
ORA-15001: Message 15001 not found; No message file for product=RDBMS, facility=ORA; arguments: [DATA_DG01]
ORA-04031: unable to allocate 56 bytes of shared memory ("shared pool","unknown object","KKSSP^215","kglseshtSegs")
Mon Oct 19 16:18:37 BST 2015
ORA-205 signalled during: ALTER DATABASE MOUNT...
Mon Oct 19 16:21:42 BST 2015
NOTE: ASMB process exiting due to lack of ASM file activity for 195 seconds
Mon Oct 19 16:21:42 BST 2015
Stopping background process RBAL

ASM alert log
--------------------

Errors in file /dboracle/orabase/diag/asm/+asm/+ASM2/trace/+ASM2_m000_16282.trc:
ORA-04031: unable to allocate 56 bytes of shared memory ("shared pool","unknown object","KKSSP^215","kglseshtSegs")
Mon Oct 19 16:19:47 2015
Process m000 died, see its trace file
Mon Oct 19 16:20:50 2015
Errors in file /dboracle/orabase/diag/asm/+asm/+ASM2/trace/+ASM2_m000_17193.trc (incident=39858):
ORA-04031: unable to allocate 56 bytes of shared memory ("shared pool","unknown object","KKSSP^215","kglseshtSegs")


Solution
==========


In ASM instance, if MEMORY_TARGET is not set, it is defaulting in 11.2.0.2 and 11.2.0.3 releases to a small value. Please be aware that Oracle is aware of this and in 11.2.0.4 this default value was increased to 1GB. See:
Bug 14292825 - ORA-4031 in ASM as default memory parameters values for 11.2 ASM instances low ( Doc ID 14292825.8 )

The solution would be to set MEMORY_TARGET to a value high enough to avoid ORA-4031 errors caused by an undersized shared pool.

From the previous action plan I would recommend to set ONLY explicit values for the MEMORY_TARGET and MEMORY_MAX_TARGET:

SQL> alter system set memory_max_target=4096m scope=spfile;
SQL> alter system set memory_target=1536m scope=spfile;

and restart the ASM instance. Or add the two parameters and their values on ASM PFILE and restart the ASM instance with modified PFILE.

These values are recommended in:
ASM Instances Are Reporting ORA-04031 Errors. ( Doc ID 1370925.1 )
where is mentioned "The number 1536m has proven to be sufficient for most environment, the change will not be effective until next restart".

The databases that are using the ASM instance have to be restarted too after ASM is restarted (they have to be down while ASM is down).