SELECT * FROM ( \
select '- Tablespace ->',t.tablespace_name ktablespace, \
'- Type->',substr(t.contents, 1, 1) tipo, \
'- Used(MB)->',trunc((d.tbs_size-nvl(s.free_space, 0))/1024/1024) ktbs_em_uso, \
'- ActualSize(MB)->',trunc(d.tbs_size/1024/1024) ktbs_size, \
'- MaxSize(MB)->',trunc(d.tbs_maxsize/1024/1024) ktbs_maxsize, \
'- FreeSpace(MB)->',trunc(nvl(s.free_space, 0)/1024/1024) kfree_space, \
'- Space->',trunc((d.tbs_maxsize - d.tbs_size + nvl(s.free_space, 0))/1024/1024) kspace, \
'- Perc->',decode(d.tbs_maxsize, 0, 0, trunc((d.tbs_size-nvl(s.free_space, 0))*100/d.tbs_maxsize)) kperc \
from \
( select SUM(bytes) tbs_size, \
SUM(decode(sign(maxbytes - bytes), -1, bytes, maxbytes)) tbs_maxsize, tablespace_name tablespace \
from ( select nvl(bytes, 0) bytes, nvl(maxbytes, 0) maxbytes, tablespace_name \
from dba_data_files \
union all \
select nvl(bytes, 0) bytes, nvl(maxbytes, 0) maxbytes, tablespace_name \
from dba_temp_files \
) \
group by tablespace_name \
) d, \
( select SUM(bytes) free_space, \
tablespace_name tablespace \
from dba_free_space \
group by tablespace_name \
) s, \
dba_tablespaces t \
where t.tablespace_name = d.tablespace(+) and \
t.tablespace_name = s.tablespace(+) \
order by 8) \
where kperc > 93 \
and tipo <>'T' \
and tipo <>'U'
tbl_space.NoDataFound=none
阅读(1094) | 评论(0) | 转发(0) |