How to test PGA growth limits
Warning: this may
crash down the entire system when no memory limits apply to Oracle OS userdeclare procedure pippo is begin pippo; end; begin pippo; end; |
Using this one you can specify a memory limit. When reached the proc will end. --Required grants to run the proc: grant all on V_$PROCESS to ALDO; grant all on V_$SESSION to ALDO; grant all on V_$mystat to ALDO; declare procedure proc(currCallNumber number, chechLimitEvery number, maxLimit number) is m number := 0; checkLimit boolean; begin checkLimit := (mod(currCallNumber, chechLimitEvery) = 0); if checkLimit then select pga_alloc_mem/1024/1024 into m from v$process, v$session where sid = (select m.sid from v$mystat m where rownum=1) and v$process.addr = v$session.paddr; end if; if m < maxLimit then proc(currCallNumber +1, chechLimitEvery, maxLimit); end if; end; begin --The procedure will stop when 100MB are reached --The check over current memory used will be performed every 200 calls proc(1, 200, 100); end;
|
| Test PGA growth using Java Stored Procedures Create the procs referring to How to Java stored procedures --Required grants to run the proc: declare s varchar2(4000); i integer; mem number := 0; maxLimit number := 200; begin --build the dummy string for i in 0..3999 loop s := s || 'e'; end loop; myjavautils.addLineToVector(s); --The procedure will stop when 100MB are reached --The check over current memory used will be performed every 50 calls while(mem < maxLimit) loop select pga_alloc_mem/1024/1024 into mem from v$process, v$session where sid = (select m.sid from v$mystat m where rownum=1) and v$process.addr = v$session.paddr; myjavautils.addLineToVector(s); dbms_output.put_line(myjavautils.getVectorSize); end loop; end; |