流云追风 2020-04-22
set linesize 200
col file_name for a50
select c.TABLESPACE_NAME,c.SEGMENT_SPACE_MANAGEMENT,d.sum_MB,d.free_MB,d.use_precent,c.EXTENT_MANAGEMENT from dba_tablespaces c,
(select b.tablespace_name,round(sum(b.bytes)/1024/1024,0) sum_MB, round(sum(nvl(a.bytes,0))/1024/1024,0) free_MB,
round((sum(b.bytes)-sum(nvl(a.bytes,0)))/sum(b.bytes),4)*100 use_precent
from (select tablespace_name,file_id,sum(bytes) bytes from dba_free_space group by tablespace_name,file_id ) a,
dba_data_files b
where a.file_id(+)=b.file_id and a.tablespace_name(+)=b.tablespace_name
group by b.tablespace_name
order by use_precent) d
where c.TABLESPACE_NAME=d.TABLESPACE_NAME
order by 5 desc;