光辉飞翔

导航

 

select a.tablespace_name as 表空间,
       a.bytes / 1024 / 1024 as 总容量MB,
       (a.bytes - b.bytes) / 1024 / 1024 "使用容量MB",
       b.bytes / 1024 / 1024 "剩余容量MB",
       round(((a.bytes - b.bytes) / a.bytes) * 100, 2) "使用百分比"
  from (select tablespace_name, sum(bytes) bytes
          from dba_data_files
         group by tablespace_name) a,
       (select tablespace_name, sum(bytes) bytes, max(bytes) largest
          from dba_free_space
         group by tablespace_name) b
 where a.tablespace_name = b.tablespace_name
 order by ((a.bytes - b.bytes) / a.bytes) desc

posted on 2012-09-11 13:25  光辉飞翔  阅读(359)  评论(0编辑  收藏  举报