denrepo

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

ora-db-size-summary.sql
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.

Open in denrepo

More Oracle scripts: Storage