Tuesday, April 29, 2008

How to estimate pga_aggregate_target

-- Displays the overall pga usage
--

select sum(value) max_pga_mem
from v$sesstat s, v$statname n
where s.statistic# = n.statistic#
and n.name = 'session pga memory max';

-- Displays the overall current pga usage

select sum(value) all_current_sess_mem
from v$sesstat s, v$statname n
where s.statistic# = n.statistic#
and n.name = 'session pga memory';

--this should be accurate
select name, sum(value/1024) "Value - KB"
from v$statname n,
v$session s,
v$sesstat t
where s.sid=t.sid
and n.statistic# = t.statistic#
and s.type = 'USER'
and s.username is not NULL
and n.name in ('session pga memory', 'session pga memory max',
'session uga memory', 'session uga memory max')
group by name;