2012年6月3日星期日

表空占用情况

SELECT a.tablespace_name, round(a.bytes / 1024 / 1024) "Sum MB",
       round((a.bytes - b.bytes) / 1024 / 1024) "used MB",
       round(b.bytes / 1024 / 1024) "free MB",
       round(((a.bytes - b.bytes) / a.bytes) * 100, 2) "percent_used"
  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;



select t.owner, t.segment_name, sum(t.BYTES) / 1024 / 1024 as size_M
  from dba_segments t
 where t.tablespace_name = ''
 group by t.owner, t.segment_name
 order by 3 desc;

没有评论:

发表评论