Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Statspack (shared pool) memory leak
I ran your script a dozen times or so (9.2.0.5 64 bit RAC on AIX 5.2) and
sure enough 04031 errors starting poping up. Unfortunately I do not have
any more time to look at this, but perhaps one of the board guru's will
look. I was wondering if you have brought this issue to Oracle support
attention?
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org]On Behalf Of Daniel Wittry
Sent: Tuesday, December 21, 2004 2:43 PM
To: oracle-l_at_freelists.org
Subject: Statspack (shared pool) memory leak
Has anyone else been collecting statspack snapshots on a regular interval and been experiencing shared pool memory leaks? Querying segment statistics (v$segment_statistics, v$segstat, or x$ksolsfts) leaks about 1400 bytes per query. After a short while, the dreaded ORA-4031 fragmented shared pool error occurs.
V9.2.0.1 thru 10.1.0.3 all leak (tested on Sun, Linux, Win, and OraMVS). The script below is one of many attempts that have resulted in a fragmented shared pool. I have tried with and without a large pool, execute_immediate, using rownum, and not using rownum, a pl/sql loop and not using pl/sql, just plain sql with a series of slashes /, /, /, /, (to repeat the last sql command). Everything leaks.
CAUTION: do not run this on an instance unless you can bounce it when done.
set heading off
column what format a40
column value format a30
spool expose_leak_2.log
select 'db instance' what, user || '@' || global_name value from
global_name
UNION
select '# rows in v$segstat', to_char(count(*)) from v$segstat
;
set linesize 200
set time on
set serveroutput on size 300000
declare
l_temp char(1); l_before number; l_after number :=3D 0; l_loop_times pls_integer :=3D 100; -- try 1000 l_sleep number :=3D 0.00; -- makes no difference=20
function get_mem return number is
cursor c_mem is select bytes from v$sgastat where name =3D 'free memory' and pool =3D 'shared pool'; r_mem c_mem%ROWTYPE; begin open c_mem; fetch c_mem into r_mem; close c_mem; return r_mem.bytes; end get_mem;
for x in 1..l_loop_times loop
l_before :=3D l_after;
--execute immediate ('select ''x'' from v$segstat s1 where rownum =
=3D
1')
spool off
-- http://www.freelists.org/webpage/oracle-l -- http://www.freelists.org/webpage/oracle-lReceived on Tue Dec 21 2004 - 14:54:14 CST
![]() |
![]() |