SQL query needed for tablespace stats

From: Jamie T. Sutton <jts_at_romulus.ncsc.mil>
Date: 26 Jan 1995 21:39:29 -0500
Message-ID: <3g9md1$85e_at_romulus.ncsc.mil>


I am currently trying to develop a script that will print some space statistics about each tablespace in my database. Most of tablespaces have only one datafile; however, a few have several datafiles. What I would like the script to do is print the tablespace name, status, total blocks, used blocks, free blocks, and percentage of blocks used for each tablespace. I have tried to write a script using a single select, but I have been unsuccessful. Here is what I currently have and cannot even get this to work right:

select t.tablespace_name,t.status,sum(d.blocks),sum(f.blocks)

    from dba_tablespaces t, dba_data_files d, dba_free_space f     where t.tablespace_name = d.tablespace_name and

          d.file_id = f.file_id
    group by t.tablespace_name,t.status;

Any help is appreciated.

Jamie Sutton Received on Fri Jan 27 1995 - 03:39:29 CET

Original text of this message