Correct tablespace script.
select
a.tablespace_name,round(a.tablespace_size,2) Tot_GB,round(b.used,2) Used_GB,
round(a.tablespace_size-b.used,2) Free_GB,
round(b.used*100/a.tablespace_size)
USEDPCT
from (select dba_data_files.tablespace_name,sum(decode(autoextensible,'YES',MAXBYTES,BYTES))/1024/1024/1024
Tablespace_Size
from dba_data_files group by
tablespace_name) a,
(select
tablespace_name,sum(bytes)/1024/1024/1024 used from dba_segments group by
tablespace_name) b
where
a.tablespace_name=b.tablespace_name and round(b.used*100/a.tablespace_size)
> 30 order by USEDPCT
desc;
No comments:
Post a Comment