SELECT A.TABLESPACE_NAME "表空间",
A.BYTES / 1024 / 1024 "总大小(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;
--转自