February 10, 2025

How to check Oracle Database Size

Check the size of the Database:

Execute the below query as sys/ system or user with DBA privilege. 

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
/


Sample Output:


Database Size        Used space           Free space
-------------------- -------------------- --------------------
500 GB               462 GB               38 GB


If you find this useful, please leave a comment. If you need the query to check for the size specific to any schema / Tables/ Please keep following the next posts.


Best Wishes!!

No comments:

Post a Comment

If you have any queries/ any suggestion please do comment and let me know.

Recent Post

Check progress on expdp and impdp

 Check progress on expdp and impdp: In few cases we need to monitor the progress of an export or import job in oracle. below are the steps c...