9.11.17

total size of oracle database

How to check the total size of oracle database


We know  oracle database consists of data files, redo log files, control files, temporary files and temporary files.

The size of the database actually means the total size of all these files.


col "Database Size" format a20
col "Free space" format a20
col "Used space" format a20
select round(sum(used.bytes) / 1024 / 1024 / 1024 ) || ' GB' "Database Size"
, round(sum(used.bytes) / 1024 / 1024 / 1024 ) -
round(free.p / 1024 / 1024 / 1024) || ' GB' "Used space"
, round(free.p / 1024 / 1024 / 1024) || ' GB' "Free space"
from (select bytes
from v$datafile
union all
select bytes
from v$tempfile
union all
select bytes
from v$log) used
, (select sum(bytes) as p
from dba_free_space) free
group by free.p
/

I found this on a blog and very use full. It will show you the total size and the used size. Total size includes size of  all files.

output will be like :-



Database Size        Used space           Free space
-------------------- -------------------- --------------------
78 GB                59 GB                19 GB

Keep sharing :)