Oracle tablespace utilization

I stole this from VS Babu

  SELECT   a.TABLESPACE_NAME,
           a.BYTES bytes_used,
           b.BYTES bytes_free,
           b.largest,
           round( ( ( a.BYTES - b.BYTES ) / a.BYTES ) * 100, 2 ) percent_used
    FROM   (   SELECT   TABLESPACE_NAME, sum( BYTES ) BYTES
                 FROM   dba_data_files
             GROUP BY   TABLESPACE_NAME ) a,
           (   SELECT   TABLESPACE_NAME, sum( BYTES ) BYTES, max( BYTES ) largest
                 FROM   dba_free_space
             GROUP BY   TABLESPACE_NAME ) b
   WHERE   a.TABLESPACE_NAME = b.TABLESPACE_NAME
ORDER BY   ( ( a.BYTES - b.BYTES ) / a.BYTES ) DESC

Leave a Reply

Your email address will not be published.

Scroll to top