background success stories

L’erreur « ORA-04030 » ne mène pas toujours à l’agrandissement de la PGA

Il arrive parfois d’avoir des erreurs ORA-04030 de ce type (extrait alert.log):

Errors in file /traces/pxxxx/bdump/xxxxxx_j013_7565.trc:
ORA-12012: error on auto execute of job 7807519
ORA-04030: out of process memory when trying to allocate ORA-04030: out of process memory when trying to allocate 16328 bytes (koh-kghu sessi,pl/sql cursor meta-data)
ORA-06500: PL/SQL: storage error
ORA-04030: out of process memory when trying to allocate 16328 bytes (koh-kghu sessi,pmuccst: adt/record)
bytes (,)
Thu Jun 07 07:58:25 CEST 2018
Errors in file /traces/pxxxx/bdump/xxxxxx_j013_7565.trc:
ORA-27102: out of memory
Linux-x86_64 Error: 12: Cannot allocate memory <<<<<<<<<<<<<<<<<
Additional information: 108
Additional information: 65536

L’erreur système peut déjà attirer notre attention.

Le fichier de trace montre qu’une partie de la mémoire est utilisée par des variables :

TOP 10 MEMORY USES FOR THIS PROCESS
---------------------------------------
75% 3968 MB, 254831 chunks: "pmuccst: adt/record "
21% 1093 MB, 70228 chunks: "pl/sql vc2 " <<<<<<<<<<<<<<<<<
4% 196 MB, 12567 chunks: "pmucalm coll

On peut surtout voir la taille limite de la PGA pour une session :

Global SGA Info
---------------
global target: 25600 MB
auto target: 10133 MB
max pga: 2048 MB
pga limit: 4096 MB <<<<<<<<<<<<<<<<<
pga limit known: 0
pga limit errors: 0

Dans notre cas, l’agrandissement de la PGA ne corrigera pas le problème. Il est préférable d’investiguer coté développement pour optimiser le code (1G utilisé pour des variables). Il est toujours possible d’augmenter cette limite (4G) en modifiant le paramètre système (vm.max_map_count) et les paramètres cachés (_use_realfree_heap et _realfree_heap_pagesize_hint en version 11.2 et inférieur).

Exemple :

sysctl -w vm.max_map_count=262144 

_use_realfree_heap=TRUE
_realfree_heap_pagesize_hint = 262144

Référence :

ORA-04030 Error For Memory Allocation Type « pl/sql vc2 » (Doc ID 1315884.1)
The memory allocation type « pl/sql vc2 » is used when Oracle needs to allocate memory for a local variable in PL/SQL code. Some examples of PL/SQL local variables are as follows: