set lines 120 pages 1000
column dummy noprint
column  pct_used format 999.9       heading "%|Used"
column  name    format a30      heading "Tablespace Name"
column  Mbytes   format 999,999,999    heading "MBytes"
column  used    format 999,999,999   heading "Used"
column  free    format 999,999,999  heading "Free"
column  largest    format 999,999,999  heading "Largest"
column  max_size format 999,999,999 heading "MaxPoss|Mbytes"
column  pct_max_used format 999.9       heading "%|Max|Used"
break   on report
compute sum of Mbytes on report
compute sum of free on report
compute sum of used on report

select nvl(b.tablespace_name,
             nvl(a.tablespace_name,'UNKOWN')) name,
       mbytes_alloc Mbytes,
       mbytes_alloc-nvl(mbytes_free,0) used,
       nvl(mbytes_free,0) free,
        ((mbytes_alloc-nvl(mbytes_free,0))/
                          mbytes_alloc)*100 pct_used,
       nvl(largest,0) largest,
       nvl(mbytes_max,mbytes_alloc) Max_Size,
       decode( mbytes_max, 0, 0, (mbytes_alloc/mbytes_max)*100) pct_max_used
from ( select sum(bytes)/1024/1024 Mbytes_free,
              max(bytes)/1024/1024 largest,
              tablespace_name
       from  sys.dba_free_space
      group by tablespace_name ) a,
     ( select sum(bytes)/1024/1024 Mbytes_alloc,
              sum(maxbytes)/1024/1024 Mbytes_max,
              tablespace_name
       from sys.dba_data_files
       group by tablespace_name
       union all
      select sum(bytes)/1024/1024 Mbytes_alloc,
              sum(maxbytes)/1024/1024 Mbytes_max,
              tablespace_name
       from sys.dba_temp_files
       group by tablespace_name )b
where a.tablespace_name (+) = b.tablespace_name
order by name;
quit
