Oracle Table Size and Tablespace Size
Learn how much each Tablespace occupies:
(Size is shown in megabytes)
select a.tablespace_name, totalspace, nvl(freespace,0) freespace,
(totalspace-nvl(freespace,0)) used,
((totalspace-nvl(freespace,0))/totalspace)*100 "%USED"
from
(select tablespace_name, sum(bytes)/1048576 totalspace
from dba_data_files
group by tablespace_name) a,
(select tablespace_name, sum(Bytes)/1048576 freespace
from dba_free_space
group by tablespace_name) b
where a.tablespace_name = b.tablespace_name (+)
and ((totalspace-nvl(freespace,0))/totalspace)*100 > 90
order by 5 desc
Now, let's find out how much space each table in the specified Tablespace occupies:
(Size in megabytes, the name of the necessary TableSpace - take from the results of the previous query, for all large databases it may take a long time)
select de.owner, de.segment_name, sum(de.bytes)/1048576, de.segment_type from dba_extents de
where de.owner in (\'нужный tablespace\')
group by de.owner, de.segment_name, de.segment_type
That's it.
Comments (0)
No comments yet.