set feed off
set pause off
set lines 80

col SEGMENT_NAME format a30

select sum(BYTES) num_bytes, max(extents) num_ex, SEGMENT_NAME
from dba_segments
where TABLESPACE_NAME = 'TEMP'
group by SEGMENT_NAME
/

set pages 1000
col file_name for a40
break on file_name skip 1 on report
compute sum of free_space on report

select df.file_name file_name, sum(fs.bytes) free_space
from dba_free_space fs, dba_data_files df
where fs.tablespace_name = 'TEMP'
and   fs.file_id = df.file_id
group by file_name
order by df.file_name;

set feed on
