select

a.TABLESPACE_NAME,

a.total,nvl(b.used,0) USED,

nvl((b.used/a.total)*100,0) PCT_USED

from

(select TABLESPACE_NAME,

sum(bytes)/(1024*1024) total

from sys.dba_data_files

group by TABLESPACE_NAME) a,

(select TABLESPACE_NAME,bytes/(1024*1024) used

from sys.SM$TS_USED) b

where a.TABLESPACE_NAME=b.TABLESPACE_NAME(+);


select fs.tablespace_name tablespace,
    (df.totalspace -  fs.freespace) used,
       fs.freespace Free,
 df.totalspace Total,
 round(100*(fs.freespace/df.totalspace)) pct
from(
select tablespace_name,round(sum(bytes)/1048576) totalspace
from dba_data_files
group by tablespace_name

)df,
(
select tablespace_name,
round(sum(bytes)/1048576) freespace
from dba_free_space
group by tablespace_name
)fs
where df.tablespace_name=fs.tablespace_name

posted on 2008-12-29 21:59  Oracle  阅读(587)  评论(0编辑  收藏  举报