select TABLESPACE , TAILLE ,TAILLEMAX, 100-((FREE+TAILLEMAX-TAILLE)/TAILLEMAX*100) "USED (%)" from
(
select TABLESPACE , sum("SIZE (M)" ) "TAILLE", sum("MAXSIZE (M)" ) "TAILLEMAX", "FREE" from
(
select d.tablespace_name "TABLESPACE",
sum(d.bytes)/1048576 "SIZE (M)",
FREESPCE "FREE",
sum(d.maxbytes)/1048576 "MAXSIZE (M)",
round(((sum(d.bytes)/1048576-FREESPCE)/(sum(d.maxbytes)/1048576)*100),2) "MAXUSED"
FROM dba_data_files d,
( SELECT
round(sum(f.bytes)/1048576,2) FREESPCE,
f.tablespace_name Tablespc
FROM dba_free_space f
GROUP BY f.tablespace_name)
WHERE d.tablespace_name = Tablespc
and d.autoextensible = 'YES'
group by d.tablespace_name,FREESPCE
union
select d.tablespace_name,
sum(d.bytes)/1048576,
FREESPCE,
sum(d.bytes)/1048576,
100 -(round((FREESPCE/(sum(d.bytes)/1048576))*100))
FROM dba_data_files d,
( SELECT
round(sum(f.bytes)/1048576,2) FREESPCE,
f.tablespace_name Tablespc
FROM dba_free_space f
GROUP BY f.tablespace_name)
WHERE d.tablespace_name = Tablespc
and d.autoextensible = 'NO'
group by d.tablespace_name,FREESPCE
order by 1 desc
)
group by tablespace, free
) order by TABLESPACE;
|