Monday 29 September 2014

Sessions PGA memory utilization Scripts

Following are some of the very useful PGA memory utilization scripts.

Total PGA Memory utilization for all Sessions

SELECT sum(trunc((VALUE/1024/1024))) || ' MB' "TOTAL MEMORY FOR ALL SESSIONS"
    FROM V$SESSTAT, V$STATNAME
    WHERE NAME = 'session pga memory'
    AND V$SESSTAT.STATISTIC# = V$STATNAME.STATISTIC#;


PGA Memory for all sessions individually 

select s.program,p.pid,s.sid,spid,s.program,s.status,
round(PGA_USED_MEM/(1024*1024),2) as PGA_USED_MEM,
round(PGA_ALLOC_MEM/(1024*1024),2) as PGA_ALLOC_MEM,
round(PGA_FREEABLE_MEM/(1024*1024),2) as PGA_FREEABLE_MEM,
round(PGA_MAX_MEM/(1024*1024),2) AS PGA_MAX_MEM
from v$process p, v$session s where s.paddr = p.addr(+)
and s.sid not in (select sid from v$mystat)
and s.machine in ('BSS\TPSIPAPP01','BSS\TPSIPAPP02')
order by p.pga_alloc_mem desc;

No comments:

Post a Comment