ORA-04031: No and possible allocate 4032 bytes of memory compa

DBA Geral (instalação, configuração do banco, scripts do Sql*Plus, shell scripts, batch scripts, etc...)
Post Reply
cream3
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 17
Joined: Mon, 17 May 2010 10:49 pm
Location: Belo Horizonte

Personal, two weeks The Oracle 8i database on Windows 2000 server with 2GB memory started to overthrow everyone and not climb anymore, I have to resicate the server to work all Dinovo.

Error in Tracert:

Select all

*** SESSION ID:(7.1) 2012-10-17 10:30:38.458 
Error in executing triggers on database startup 
*** 2012-10-17 10:30:38.817 
ksedmp: internal or fatal error 
ORA-00604: ocorreu um erro no nivel 1 SQL recursivo 
ORA-04031: n?o e possivel alocar 4032 bytes de memoria compartilhada ("shared pool","java/lang/StringSYS","joxlod: in ehe","ioc_allocate_pal") 
ORA-06512: em "SYS.DBMS_JAVA", line 0 
ORA-06512: em line 2

My init.ora

Select all

b_files = 1024 
 
control_files = ("D:\Oracle\oradata\TESTE\control01.ctl", "D:\Oracle\oradata\TESTE\control02.ctl", "D:\Oracle\oradata\TESTE\control03.ctl") 
 
open_cursors = 100 
max_enabled_roles = 100 
#db_file_multiblock_read_count = 8 
db_file_multiblock_read_count = 16 
 
db_block_buffers = 51658 
#db_block_buffers = 25829 
 
#shared_pool_size = 35265536 
#shared_pool_size = 82067456 
shared_pool_size = 117332992 
 
large_pool_size = 614400 
#java_pool_size = 20971520 
java_pool_size = 0 
 
#log_checkpoint_interval = 10000 
#log_checkpoint_timeout = 1800 
FAST_START_IO_TARGET  = 90
In many Internet topics informs for dinimuir or almmenting shared_pool_size that is currently in 177MB.
I noticed that the java_pool_size is set at 0.

any suggestion ??
User avatar
stcoutinho
Moderador
Moderador
Posts: 850
Joined: Wed, 11 May 2011 5:15 pm
Location: são Paulo - SP

Hello Cream3,
First, a description of the error and corrective action, according to Oracle:

Select all

Problem: ORA-04031 - unable to allocate string bytes of shared memory ("string","string","string","string")  
 
Cause: More shared memory is needed than was allocated in the shared pool. 
  
Action: If the shared pool is out of memory, either use the dbms_shared_pool package to pin large packages, reduce your use of shared memory, or increase the amount of available shared memory by increasing the value of the INIT.ORA parameters "shared_pool_reserved_size" and "shared_pool_size". If the large pool is out of memory, increase the INIT.ORA parameter "large_pool_size". 
You should then Focus on parameters shared_pool_resved_size, shared_pool_size and large_pool_size.

The Specialist Burleson mentions in his article http://www.dba-oracle.com/sf_ora_04031_ ... memory.htm that can be used the description below to identify the current pool consumption (cover pool cover) and compare the same with the large_pool_size parameter:

Select all

SELECT  
   name,  
   SUM(bytes)  
FROM  
   V$SGASTAT  
WHERE  
   pool='LARGE POOL'  
GROUP BY  
   ROLLUP(name);
If by accident this queries value is right next to the parameter, you could try to fold (or increase in 1.5) the large_pool_size startup parameter. In the article, Burleson mentions that the occurrence of ORA-04031 can be significantly reduced.

Meanwhile, as far as I could understand, your database worked normally until a while ago.

From here, would you know how to say or what changed? Some suggestions / examples:

- a new system was deployed;
- Maintenance was implemented;
- increased the number of users' accesses;
- New features were added to the application, such as a processing batch routine.

As I could understand this error message, your SGA seems to be fragmentation. This can be caused by lack of bind variables in your Java PL / SQL code.

In an ASKTOM Forum article http://asktom.oracle.com/pls/asktom/f?p ... 8893984337), OM Kyte alert that sometimes this error can be caused by poor encoding of SQL commands, specifically the lack of bind variables.

For example, you have a system that performs this type of command (examples taken from the previous link):

Select all

INSERT INTO gfx_suggestion (suggestion, suggestion_id, timestamp,  
suggestion_type_fl, 
name, email, business_unit_key) select 'test suggestion. RJ 04/19/01',  
max(suggestion_id)+1, sysdate, 'T', 'Ron Jennings' , 'rj@rwd.com', '5' from  
gf_suggestion 
When in fact, it should be performed in this way (with bind variables):

Select all

INSERT INTO gfx_suggestion (suggestion, suggestion_id, timestamp,  
suggestion_type_fl, 
name, email, business_unit_key) select :1, max(suggestion_id)+1, sysdate, :2, :3, :4, :5  
from gf_suggestion 
 
an excess command "hard-code" as the first insert can generate A fragmentation of the SGA with these "poor" SQL written commands. Note that the second command eventually could be used more than once by Oracle, since the values ??are not in "hard-code", but in the form of variables.

Even if you solve your problem by increasing the Large_pool_Size, I would recommend you have a chat with your developers to check the quality of the generated PL / SQL code.

This error may be related to product bugs.

The link below offers a comprehensive view of this problem:
http://jametong.itpub.net/post/5042/27713

I hope it can solve your problems with this information .

Hugs,

Sergio Coutinho
cream3
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 17
Joined: Mon, 17 May 2010 10:49 pm
Location: Belo Horizonte

Sergio, good morning!

first I would like to congratulate you by the answer. It was practically an entire article. Altissima quality content.

Good,

answering the questions:

From here, would you know how to say or what has changed? Some suggestions / examples: (I am recent in the company, but from what I realized has not changed virtually nothing at a good time. I also realized that the installation of Oracle in this "server / desktop" was performed with NEXT, Next Finish around a year and half behind. All configuration is standard.
The accesses are internal in ERP written in Delph 3.

- a new system was deployed; .
- Maintenance has been implemented; >> Maintenance has been implemented.
- increased the number of users' accesses; >> Quantity of users access increased, but, I believe it would not be a concern. So large due not to reach at least 30 sessions on the server.
- New resources were added to the application, such as a processing batch routine. >> No new routines have been implemented.

] The query suggested in the Burlean article brought these results:

Free Memory: 614400
<null> / alias: 614400

Another analysis was the code written in Delph and a conversation with the programmers responsible for the maintenance of the system. The application is all written with BID variables.

Some other checks follows:

- indicated that must be greater than 90%, otherwise increase the db_cache_size boot parameter.

Select all

select   100*(1 - (v3.value / (v1.value + v2.value))) "Cache Hit Ratio [%]" 
from  v$sysstat v1, v$sysstat v2, v$sysstat v3 
where 
  v1.name = 'db block gets' and 
  v2.name = 'consistent gets' and 
  v3.name = 'physical reads'

Select all

DB Cache	Data	                10:00	15:00 
DB Cache	15/10/2012	97,8	        98,8 
DB Cache	16/10/2012	98,6   	98 
DB Cache	18/10/2012	98,7	         98,4 
DB Cache	19/10/2012	98,51	97,8
- The waiting number must always be zero. Otherwise, increase the size of the log_redo, until the return of the number to zero. (Red Log Space Requests)

Select all

Select name, value from v$sysstat 
Where name in ('redo log space requests', 'redo log space wait time');

Select all

Tempo Espera Redo Log	Data	             10:00	15:00 
Tempo Espera Redo Log	15/10/2012	7	21 
Tempo Espera Redo Log	16/10/2012	27	41 
Tempo Espera Redo Log	18/10/2012	8	80 
Tempo Espera Redo Log	19/10/2012	7	36
- Increase buffer size if it is less than 5,000.

Select all

Select Round(e.value/s.value,5) "Redo Log Ratio" 
From v$sysstat s, v$sysstat e 
Where s.name = 'redo log space requests' 
and e.name = 'redo entries';

- When "Hit Ratio" <99%, Increase Shared_pool_Size

Select all

select sum(pins) "Executions",sum(reloads) "Cache Misses while Executing",round((sum(pins)/(sum(reloads)+sum(pins)))*100,2)  
"Hit Ratio, %" from V$LIBRARYCACHE;

Select all

select sum(pins) "Executions",sum(reloads) "Cache Misses while Executing",round((sum(pins)/(sum(reloads)+sum(pins)))*100,2)  
"Hit Ratio, %" from V$LIBRARYCACHE;
99]]

Select all

Acesso Cache Banco "Hit Ratio"	Data	                10:00	15:00 
Acesso Cache Banco "Hit Ratio"	15/10/2012	99,99%	100% 
Acesso Cache Banco "Hit Ratio"	16/10/2012	99,99	100 
Acesso Cache Banco "Hit Ratio"	18/10/2012	99,99	100 
Acesso Cache Banco "Hit Ratio"	19/10/2012	99,99	100

- When "Misses ratio"> 1% Increase shared_pool_size

Select all

select sum(pins) "Executions",sum(reloads) "Cache Misses while Executing",round(sum(reloads)/sum(pins)*100,2)  
AS "Misses Ratio, %" from V$LIBRARYCACHE;

or [9]]

Select all

Acesso disco "Misses Ratio"	Data	                10:00	15:00 
Acesso disco "Misses Ratio"	15/10/2012	0,734	0,342 
Acesso disco "Misses Ratio"	16/10/2012	0,645	0,41 
Acesso disco "Misses Ratio"	18/10/2012	0,621	0,37 
Acesso disco "Misses Ratio"	19/10/2012	0,606	0,32

I have not yet been able to identify the bottleneck, but one of the checks that calls me a lot of attention is about disk access Although the hit ratio demonstrates me 99.99%

It seems that the recommended is: if number of disc accesses is much higher than zero increase the Sort_AREA_SIZE


[12]]

I am not yet very safe to carry out such modifications.
User avatar
stcoutinho
Moderador
Moderador
Posts: 850
Joined: Wed, 11 May 2011 5:15 pm
Location: são Paulo - SP

Cream3,

I ended up researching a little more about the subject within Oracle's own Metallink.

According to note 115256.1, this error may occur when performing Loadjava operations (Java or JavaBeans class load) in Oracle 8i. Do the systems that access your bank are used from Java resources?

The note asks to download the bank, reconfigure the Java_Pool_Size and Sahred_Pool Size values ??to larger values. It mentions that a typical Oracle 8i installation (8.1.6 / 8.1.5) generally presents the shared_pool_size with 52428800 (50MB) and the Java_Pool_Size with 20971520 (20MB).

Values ??smaller than these described can cause the error message or-04031.

An additional explanation in the note is that this error message can be confused with lack of memory in Shared Global Area (SGA), but - at the end - would be a symptom of a Java_Pool_Size configured with A low value.

Another note - 105472.1 - provides more information on how to configure the JVM used by Oracle 8i.

Then it may be interesting to make an experience and try to reconfigure / resize zero zero to the value mentioned in the note (20MB). Follow up in Alert Log to see if errors decrease and nothing more wrong is occurring.

I hope this solves your problem.

Hugs and good luck!

Sergio Coutinho
cream3
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 17
Joined: Mon, 17 May 2010 10:49 pm
Location: Belo Horizonte

Well, so far he stopped.
I realized the increase in Java_Pool_Size memory from 0 to 20m.
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests