Oracle查询表空间的使用情况的SQL语句,很实用

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://xxlcube.blog.csdn.net/article/details/8217199
SELECT   a.a1 TableSpace_Name,
         c.c2 Type_,
         c.c3 LocalAdmin,
         b.b2 / 1024 / 1024 TS_Size,
         (b.b2 - a.a2) / 1024 / 1024 Used_Size,
         SUBSTR ( (b.b2 - a.a2) / b.b2 * 100, 1, 5) Used_Ratio
  FROM   (  SELECT   tablespace_name a1, SUM (NVL (bytes, 0)) a2
              FROM   dba_free_space
          GROUP BY   tablespace_name) a,
         (  SELECT   tablespace_name b1, SUM (bytes) b2
              FROM   dba_data_files
          GROUP BY   tablespace_name) b,
         (SELECT   tablespace_name c1, contents c2, extent_management c3
            FROM   dba_tablespaces) c
 WHERE   a.a1 = b.b1 AND c.c1 = b.b1;

展开阅读全文

没有更多推荐了,返回首页