24 июл. 2014 г.

on Leave a Comment

Check Free space in tablespace

Using the script below, you can check the free space in tablespace. I think it show a really friendly info.

Column USED_SPACE -  display how much space is consumed by data in MB.
Column ALLOC_SPACE - display the real size in MB of tablespace on the disk (summarized size of all datafiles of the tablespace)
Column MAX_SPACE - display the Max size of Tablespace taking into consideration the AUTOEXTENSIBLE parameter in Datafile

select
a.tablespace_name,round(sum(a.bytes)/(1024*1024),2) "USED_SPACE",
(select sum(b.bytes)/(1024*1024)
from dba_data_files b
where a.tablespace_name=b.tablespace_name
group by b.tablespace_name) "ALLOC_SPACE",
(select
sum(greatest(b.bytes/(1024*1024),b.maxbytes/(1024*1024)))
from dba_data_files b
where a.tablespace_name=b.tablespace_name
group by b.tablespace_name) "MAX_SPACE",
round((
(select sum(c.bytes)/(1024*1024)
from dba_segments c,dba_tablespaces d
where c.tablespace_name=d.tablespace_name and a.tablespace_name=d.tablespace_name
group by d.tablespace_name)*100/
(select sum(greatest(b.bytes/(1024*1024),b.maxbytes/(1024*1024)))
from dba_data_files b
where a.tablespace_name=b.tablespace_name
group by b.tablespace_name)
),0) "PCT"
from dba_segments a
group by a.tablespace_name
order by a.tablespace_name


Result:




0 коммент.:

Отправить комментарий

Технологии Blogger.