Monday, December 10, 2018

Database size


The size of the database is the space the files physically consume on disk. You can find this with: 

select sum(bytes)/1024/1024 size_in_mb from dba_data_files;

But not all this space is necessarily allocated. There could be sections of these files that are not used. 

You can find the total space that is used with: 

select sum(bytes)/1024/1024 size_in_mb from dba_segments;

You can break this down by user by running: 

select owner, sum(bytes)/1024/1024 Size_MB from dba_segments
group  by owner;

Check used and free space:
select
"Reserved_Space(GB)", "Reserved_Space(GB)" - "Free_Space(GB)" "Used_Space(MB)","Free_Space(GB)"
from(
select
(select sum(bytes/(1014*1024*1024)) from dba_data_files) "Reserved_Space(GB)",
(select sum(bytes/(1024*1024*1024)) from dba_free_space) "Free_Space(GB)"
from dual
);

No comments:

Post a Comment