dataiotech Labs
dbaguidedbaguideDBAdataxtoolsdataopsphere
Scripts Library/oracle/#68
Script #68
oracle
Storageread-onlyMin Version: 11g

Largest Segments and Tables in Oracle

Lists the tables, indexes and LOB segments that take the most space. Used for growth analysis and archiving decisions.

#segments#dba_segments#capacity
oracle · sql
SELECT * FROM (
  SELECT owner, segment_name, segment_type, tablespace_name,
         ROUND(bytes / 1048576, 1) AS size_mb
  FROM   dba_segments
  WHERE  owner NOT IN ('SYS','SYSTEM','SYSAUX','XDB','MDSYS','CTXSYS')
  ORDER  BY bytes DESC
) WHERE ROWNUM <= 25;
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.