Apps DBA Concepts

Just another WordPress.com weblog

Free Space SQL

Posted by vasselva on May 15, 2008

Free Space query
—————

SELECT dbaspace.tablespace_name “Tablespace Name”,
nvl(sum(dbaspace.total_space),0) “Total”,
nvl((sum(dbaspace.total_space) – sum(dbaspace.free_space)),0) “Used”,
nvl(sum(dbaspace.free_space),0) “Free”,
nvl((sum(dbaspace.free_space)/sum(dbaspace.total_space)*100),0) “Free Percentage”
FROM
(
select tablespace_name,0 total_space,sum(bytes/(1024*1024)) free_space
from dba_free_space
group by tablespace_name
union
select tablespace_name,0 total_space,sum(bytes/(1024*1024)) free_space
from dba_temp_files
group by tablespace_name
union
select tablespace_name,sum(bytes/(1024*1024)) total_space,0 from
dba_data_files
group by tablespace_name
union
select tablespace_name,sum(bytes/(1024*1024)) total_space,0 from
dba_temp_files
group by tablespace_name) dbaspace
group by dbaspace.tablespace_name
order by dbaspace.tablespace_name
/

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>