← RAC
Oracle · RAC

How to check session memory across all RAC instances in Oracle

Rank Oracle sessions by PGA memory across every RAC instance from GV$SESSTAT.

Tested on11g12c18c19c21c23ai26ai

GV$SESSION + GV$SESSTAT + GV$STATNAME across all instances. Filters to sessions with a program set (excludes system slots) and orders by PGA memory descending — quickly finds the biggest memory user across the whole cluster.

SET LINESIZE 200
COLUMN username FORMAT a20
COLUMN module   FORMAT a20

SELECT a.inst_id,
       NVL(a.username, '(oracle)') AS username,
       a.module,
       a.program,
       TRUNC(b.value / 1024) AS memory_kb
FROM   gv$session  a,
       gv$sesstat  b,
       gv$statname c
WHERE  a.sid         = b.sid
AND    a.inst_id     = b.inst_id
AND    b.statistic#  = c.statistic#
AND    b.inst_id     = c.inst_id
AND    c.name        = 'session pga memory'
AND    a.program IS NOT NULL
ORDER BY b.value DESC;
racmemorypgagv$sesstat