oracke数据库表空间大小查看

时间:2021-06-20 03:25:57
SELECT T1 "表空间",
       Z / 1024 / 1024 / 1024 "总表空间G",
       (Z - S) / 1024 / 1024 / 1024 "已用表空间G",
       S / 1024 / 1024 / 1024 "剩余表空间G",
       ROUND((Z - S) / Z * 100, 2) "使用率%",
       (Z - S) / 1024 / 1024 / 1024 / 0.7 - (Z / 1024 / 1024 / 1024) "扩展空间"
  FROM 
(SELECT TABLESPACE_NAME T1, SUM(BYTES) S
  FROM DBA_FREE_SPACE
 GROUP BY TABLESPACE_NAME),
 (SELECT TABLESPACE_NAME T2, SUM(BYTES) Z
      FROM DBA_DATA_FILES
      GROUP BY TABLESPACE_NAME)
 WHERE T1 = T2 order by 5 DESC;