Wednesday, May 07, 2008

sga_target and its compoents

Although we see Oracle make it easier to dynamically manager its compoments: shared pool, large pool, buffer cache , java pool .

However, based on my bleeding experience, it is better estimate & set a minimal value for them, especially for:
1. shared pool
2. large pool if you are using shared server.

monitor its historical size and set at least 85% of maximum size as minimal size, is my recommendation.

Too small value of shared pool may result in execution plan changed.

Too small large pool may caused ora-4031 related to large pool (shared server connection)

Below two statements help.
--check on the breakdown of sga usage.
set linesize 132 pagesize 5000
col snap_time format a30
select s2.begin_interval_time snap_time,pool sga_component,sum(bytes) bytes from
dba_hist_sgastat s1, dba_hist_snapshot s2
where s1.pool is not null
and s1.snap_id=s2.snap_id
group by s2.begin_interval_time,pool
union
select s2.begin_interval_time snap_time,name sga_component, bytes from dba_hist_sgastat s1, dba_hist_snapshot s2
where name ='buffer_cache'
and s1.snap_id=s2.snap_id
ORDER BY 2,1
/

select component,current_size from v$sga_dynamic_components;

COMPONENT CURRENT_SIZE
---------------------------------------------------------------- ------------
shared pool 671088640
large pool 536870912
java pool 16777216
streams pool 0
DEFAULT buffer cache 1493172224
KEEP buffer cache 0
RECYCLE buffer cache 0
DEFAULT 2K buffer cache 0
DEFAULT 4K buffer cache 0
DEFAULT 8K buffer cache 0
DEFAULT 16K buffer cache 0
DEFAULT 32K buffer cache 0
ASM Buffer Cache 0

13 rows selected.

SQL> alter system set shared_pool_size=750M;

System altered.

SQL> set pages 1000
SQL> select component,current_size from v$sga_dynamic_components;

COMPONENT CURRENT_SIZE
---------------------------------------------------------------- ------------
shared pool 788529152
large pool 536870912
java pool 16777216
streams pool 0
DEFAULT buffer cache 1375731712
KEEP buffer cache 0
RECYCLE buffer cache 0
DEFAULT 2K buffer cache 0
DEFAULT 4K buffer cache 0
DEFAULT 8K buffer cache 0
DEFAULT 16K buffer cache 0
DEFAULT 32K buffer cache 0
ASM Buffer Cache 0

13 rows selected.