dataiotech Labs
dbaguidedbaguideDBAdataxtoolsdataopsphere
Scripts Library/oracle/#75
Script #75
oracle
Monitoringread-onlyMin Version: 11g

Oracle SGA and PGA Memory Usage

Shows SGA components and PGA target versus actual usage. The first data point for memory sizing decisions.

#sga#pga#memory#advisor
oracle · sql
SELECT name, ROUND(bytes / 1048576) AS mb FROM v$sgainfo ORDER BY bytes DESC;

SELECT name, ROUND(value / 1048576) AS mb
FROM   v$pgastat
WHERE  name IN ('aggregate PGA target parameter','total PGA allocated','maximum PGA allocated','cache hit percentage');
Operational Notes & Remediation Guidance

Verify in a staging environment prior to running in production. This is a read-only diagnostic query; it does not acquire exclusive locks.

Production Safety & Execution Standards
  • This script is designed for read-only diagnostics; it does not alter schema or modify data directly.
  • Prior to executing on production systems under high load, verify the target database version (Min. Version: 11g).
  • Exercise caution with mutating actions (e.g., terminating sessions or dropping indexes) referenced in the notes section.