← Performance
Oracle · Performance
How to check SGA used, free, and total memory in Oracle
Break Oracle SGA into used and free MB from V$SGASTAT, alongside total SGA size.
Tested on11g12c18c19c21c23ai26ai
V$SGASTAT breaks the SGA into named pools. Summing everything except ''free memory'' gives you what is actually in use; ''free memory'' by itself is what is available for growth.
SELECT ROUND(used.bytes / 1024 / 1024, 2) AS used_mb,
ROUND(free.bytes / 1024 / 1024, 2) AS free_mb,
ROUND(tot.bytes / 1024 / 1024, 2) AS total_mb
FROM (SELECT SUM(bytes) bytes FROM v$sgastat WHERE name != 'free memory') used,
(SELECT SUM(bytes) bytes FROM v$sgastat WHERE name = 'free memory') free,
(SELECT SUM(bytes) bytes FROM v$sgastat) tot;performancememorysgav$sgastat