select df.tablespace_name "表空间名称",
totalspace "空间大小/M",
freespace "剩余空间/M",
round((1 - freespace / totalspace) * 100, 2) "表空间使用率%"
from (select tablespace_name, round(sum(bytes) / 1024 / 1024) totalspace
from dba_data_files
group by tablespace_name) df,
(select tablespace_name, round(sum(bytes) / 1024 / 1024) freespace
from dba_free_space
group by tablespace_name) fs
where df.tablespace_name = fs.tablespace_name;
totalspace "空间大小/M",
freespace "剩余空间/M",
round((1 - freespace / totalspace) * 100, 2) "表空间使用率%"
from (select tablespace_name, round(sum(bytes) / 1024 / 1024) totalspace
from dba_data_files
group by tablespace_name) df,
(select tablespace_name, round(sum(bytes) / 1024 / 1024) freespace
from dba_free_space
group by tablespace_name) fs
where df.tablespace_name = fs.tablespace_name;