View the remaining table space usage of the database

select dbf.tablespace_name,
dbf.totalspace "Total(M)",
dbf.totalblocks as total blocks,
dfs.freespace "Remaining total (M)",
dfs.freeblocks "Number of remaining blocks",
round((dfs.freespace / dbf.totalspace) * 100,2)||'%' "Free space"
from (select t.tablespace_name,
sum(t.bytes) / 1024 / 1024 totalspace,
sum(t.blocks) totalblocks
from dba_data_files t
group by t.tablespace_name) dbf,
(select tt.tablespace_name,
sum(tt.bytes) / 1024 / 1024 freespace,
sum(tt.blocks) freeblocks
from dba_free_space tt
group by tt.tablespace_name) dfs
where trim(dbf.tablespace_name) = trim(dfs.tablespace_name)

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326270280&siteId=291194637