[Oracle]Tablespace usage check

select t.tablespace_name tablespace_name,

 total_bytes / 1024 tablespace_kbytes,

 (total_bytes - free_buytes) / 2014 used_kbytes,

 free_bytes / 1024 free_kbytes,

 to_char(((total_bytes - free_bytes) / (total_bytes)) * 100, ‘990.99') || '%' capacity

from

 (select tablespace_name, sum(bytes) total_bytes

 from dba_data_files

 group by tablespace_name) t,

 (select tablespace_name, sum(bytes) free_bytes

 from dba_free_space

 group by tablespace_name) f

where t.tablespace_name = f.tablespace.name

 and t.tablespace_name in ('XXXXTablespaceName‘)

order by t.tablespace_name;

原文地址:https://www.cnblogs.com/andyjia/p/4644748.html