OracleStorage
Database size summary: total, used and free
One line with the database name and its total size (datafiles, temp files and redo logs), used space and free space, rounded to whole GB.
Tested on 12c, 19c · verified Sep 2026
1CLEAR COLUMNS2SET LINESIZE 120 PAGESIZE 100 TRIMOUT ON TAB OFF3show parameter db_name4 5col "Database Size" format a206col "Free space" format a207col "Used space" format a208select round(sum(used.bytes) / 1024 / 1024 / 1024 ) || ' GB' "Database Size"9, round(sum(used.bytes) / 1024 / 1024 / 1024 ) -10 round(free.p / 1024 / 1024 / 1024) || ' GB' "Used space"11, round(free.p / 1024 / 1024 / 1024) || ' GB' "Free space"12from (select bytes13 from v$datafile14 union all15 select bytes16 from v$tempfile17 union all18 select bytes19 from v$log) used20, (select sum(bytes) as p21 from dba_free_space) free22group by free.p;Save it as ora-db-size-summary.sql and run it with SQL> @ora-db-size-summary.
More Oracle scripts: Storage
- Datafile usage with a bar graphEvery datafile with its size, used space, max size and a ten-character usage bar (X = used, - = free). Free_MB is the largest free extent in the…
- Database size three ways: allocated, used and totalAllocated datafile size, space actually used by segments, and the overall footprint including temp files, online redo logs and control files. All in…
- Size of one schemaTotal segment size in GB for the schema you enter.
- Tablespace usageUsed and free space in GB against the maximum each tablespace can autoextend to, with its type (permanent, temporary or undo), fullest first.
- Datafiles with size and autoextend limitsEvery datafile, its current size, whether it can grow, and how far. Files with AUTOEXTEND NO in a busy tablespace are the ones that page you at night.
- Top 20 largest segmentsThe biggest tables, indexes, LOBs and partitions in the database.