Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, krishna.

Asked: January 19, 2017 - 9:23 am UTC

Last updated: January 21, 2017 - 4:45 am UTC

Version: 10.2.0.0

Viewed 1000+ times

You Asked

Hi Tom& Team,

Thanks much for your valuable expertise answers with explanation.

Since past one month users queries are getting error out with "ora-04031-unable allocate xxx bytes of shared memory" very frequently and for that fix had to bounce the db even we can't able to query anything in the database

Could you let me know how to avoid this issue and is there any way to calculate optimal size to shared pool ?

and Connor said...

Lots of *potential* causes of ora-4031. I'd strongly suggest you have a look at MOS note 1088239.1.

But also, we have a diagnosis tool which will help as well. See MOS Note 1521925.1


You could do something like

SQL> select * from v$sgastat order by pool, bytes desc;

POOL         NAME                                          BYTES     CON_ID
------------ ---------------------------------------- ---------- ----------
java pool    free memory                                16777216          0
large pool   free memory                                33292288          0
large pool   PX msg pool                                  262144          0
shared pool  free memory                               115875992          0
shared pool  allocate segment latch re                  58802176          0
shared pool  KGLH0                                      39358864          0
shared pool  SQLA                                       27873360          0
shared pool  KQR X SO                                   13357016          0
shared pool  write state object                         13023264          0
shared pool  db_block_hash_buckets                      11538432          0
shared pool  event statistics per sess                  11512064          0
shared pool  KGLS                                       10598168          0
shared pool  KGLHD                                      10591064          0
shared pool  PLMCD                                       9017784          0
shared pool  row cache                                   8656032          0
...


to see what are the high consumers in the shared pool, but typically

a) the information is somewhat crytpic
b) changes rapidly

As a stopgap solution whilst you investigate the cause, you can look at increasing the size of the shared pool via init.ora parameter.


Is this answer out of date? If it is, please let us know via a Comment