select a.tablespace_name "表空间名",
Total / (1024 * 1024 * 1024) "表空间大小(G)",
Free / (1024 * 1024 * 1024) "表空间剩余大小(G)",
(Total - Free) / (1024 * 1024 * 1024) "表空间使用大小(G)",
Round((Total - free) / Total, 4) * 100 "使用率(%)"
from (select tablespace_name,SUM(bytes) Free
from dba_free_space
group by tablespace_name) a,
(select tablespace_name,SUM(bytes) total
from dba_data_files
group by tablespace_name) b
where a.tablespace_name=b.tablespace_name