Tablespace Usage
--
-- Tablespace Usage
--

CLEAR BREAKS
CLEAR COLUMNS
CLEAR COMPUTES
SET VERIFY OFF
COL tablespace_name HEA 'Tablespace Name' FOR a20
COL ambytecount HEA 'Available' FOR 99999999999.999
COL umbytecount HEA '  Used   ' FOR 99999999999.999

SELECT ddf.tablespace_name,
       SUM( distinct ddf.ddfbytes )/1048576 ambytecount,
       SUM( NVL( ds.bytes , 0 ) / 1048576 ) umbytecount
FROM 
   ( SELECT tablespace_name, SUM( bytes ) ddfbytes
     FROM dba_data_files
     GROUP BY tablespace_name ) ddf,
   dba_segments ds
WHERE ddf.tablespace_name = ds.tablespace_name (+)
GROUP BY ddf.tablespace_name
/

Related Scripts

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License