← Performance
Oracle · Performance
How to check current and maximum SGA and PGA usage in Oracle
Quick view of Oracle current SGA size, current PGA in use, maximum SGA size, and maximum PGA allocated.
Tested on11g12c18c19c21c23ai26ai
Four short queries against V$SGASTAT, V$SGAINFO, and V$PGASTAT for the four numbers you actually want when someone asks how much memory Oracle is using right now.
-- Current SGA size
SELECT SUM(bytes / 1024 / 1024) AS current_sga_size_mb
FROM v$sgastat;
-- Current PGA in use
SELECT (value / 1024 / 1024) AS current_pga_in_use_mb
FROM v$pgastat
WHERE name = 'total PGA inuse';
-- Maximum SGA size
SELECT SUM(bytes / 1024 / 1024) AS max_sga_size_mb
FROM v$sgainfo
WHERE name = 'Maximum SGA Size';
-- Maximum PGA allocated
SELECT (value / 1024 / 1024) AS max_pga_allocated_mb
FROM v$pgastat
WHERE name = 'maximum PGA allocated';performancememorysgapga