Tuesday, June 9, 2009

Tablespace Space report in a single SQL query

Use this query to get the tablespace report. The total space may not be exactly equal to free space plus occupied space as the total space taking header info space too.

select a.tablespace_name,
a.bytes/1024/1024 as total_space_MB,
b.bytes/1024/1024 as free_space_MB,
c.bytes/1024/1024 as occpied_space_MB
from sm$ts_avail a ,
sm$ts_free b,
sm$ts_used c
where a.tablespace_name=b.tablespace_name
and a.tablespace_name=c.tablespace_name;

No comments: