SELECT TOTAL.TNAME "表空间名称",
TOTAL.TOTAL_SIZE "表空间大小",
TOTAL.TOTAL_SIZE - USED.FREE_SIZE AS "已使用大小",
USED.FREE_SIZE AS 表空间剩余大小,
ROUND((TOTAL.TOTAL_SIZE - USED.FREE_SIZE) / TOTAL.TOTAL_SIZE, 4) * 100 || '%' AS 表空间使用率
FROM ( -- 表空间数据文件的大小
SELECT TABLESPACE_NAME AS TNAME,
ROUND(SUM(USER_BYTES) / (1024 * 1024), 1) AS TOTAL_SIZE
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME) TOTAL,
( -- 表空间剩余的大小
SELECT TABLESPACE_NAME AS TNAME,
ROUND(SUM(BYTES) / (1024 * 1024), 1) AS FREE_SIZE
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) USED
WHERE TOTAL.TNAME = USED.TNAME(+)
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/holion/archive/2008/06/27/2591864.aspx