Search This Blog

Total Pageviews

Wednesday, 2 February 2011

Oracle Session in Shared Pool

select sid,
username,
round(total_user_mem/1024/1024,2) mem_used_in_mb,
round(100 * total_user_mem/total_mem,2) mem_percent
from
(select
b.sid sid,
nvl(b.username,p.name) username,
sum(value) total_user_mem
from
sys.v_$statname c,
sys.v_$sesstat a,
sys.v_$session b,
sys.v_$bgprocess p
where
a.statistic#=c.STATISTIC# and
p.paddr (+) = b.paddr and
b.sid=a.sid and
c.name in ('session pga memory','session uga memory')
group by
b.sid, nvl(b.username,p.name)),
(select
sum(value) total_mem
from
sys.v_$statname c,
sys.v_$sesstat a
where
a.statistic#=c.STATISTIC# and
c.name in ('session pga memory','session uga memory'))
order by 3 desc;

2 comments:

Unknown said...

Thanks for this request, I add a compute to calculate the memory allocated:


set linesize 120
col USERNAME format a15
set pages 50
COMPUTE SUM OF mem_used_in_mb ON REPORT
BREAK ON REPORT
COLUMN DUMMY HEADING ''
SELECT ' ' DUMMY, sid,
username,
round(total_user_mem/1024/1024,2) mem_used_in_mb,
round(100 * total_user_mem/total_mem,2) mem_percent
from
(select
b.sid sid,
nvl(b.username,p.name) username,
sum(value) total_user_mem
from
sys.v_$statname c,
sys.v_$sesstat a,
sys.v_$session b,
sys.v_$bgprocess p
where
a.statistic#=c.STATISTIC# and
p.paddr (+) = b.paddr and
b.sid=a.sid and
c.name in ('session pga memory','session uga memory')
group by
b.sid, nvl(b.username,p.name)),
(select
sum(value) total_mem
from
sys.v_$statname c,
sys.v_$sesstat a
where
a.statistic#=c.STATISTIC# and
c.name in ('session pga memory','session uga memory'))
order by 4 desc;

Unknown said...

Thanks for this request, I add a compute to calculate the memory allocated:


set linesize 120
col USERNAME format a15
set pages 50
COMPUTE SUM OF mem_used_in_mb ON REPORT
BREAK ON REPORT
COLUMN DUMMY HEADING ''
SELECT ' ' DUMMY, sid,
username,
round(total_user_mem/1024/1024,2) mem_used_in_mb,
round(100 * total_user_mem/total_mem,2) mem_percent
from
(select
b.sid sid,
nvl(b.username,p.name) username,
sum(value) total_user_mem
from
sys.v_$statname c,
sys.v_$sesstat a,
sys.v_$session b,
sys.v_$bgprocess p
where
a.statistic#=c.STATISTIC# and
p.paddr (+) = b.paddr and
b.sid=a.sid and
c.name in ('session pga memory','session uga memory')
group by
b.sid, nvl(b.username,p.name)),
(select
sum(value) total_mem
from
sys.v_$statname c,
sys.v_$sesstat a
where
a.statistic#=c.STATISTIC# and
c.name in ('session pga memory','session uga memory'))
order by 4 desc;

Oracle DBA

anuj blog Archive