SELECT DF.TABLESPACE_NAME "表空间名",
TOTALSPACE "总空间G",
FREESPACE "剩余空间G",
ROUND((1 - FREESPACE / TOTALSPACE) * 100, 2) "使用率%"
FROM (SELECT TABLESPACE_NAME,
ROUND(SUM(BYTES) / 1024 / 1024 / 1024, 2) TOTALSPACE
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME) DF,
(SELECT TABLESPACE_NAME,
ROUND(SUM(BYTES) / 1024 / 1024 / 1024, 2) FREESPACE
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) FS
WHERE DF.TABLESPACE_NAME = FS.TABLESPACE_NAME;
TOTALSPACE "总空间G",
FREESPACE "剩余空间G",
ROUND((1 - FREESPACE / TOTALSPACE) * 100, 2) "使用率%"
FROM (SELECT TABLESPACE_NAME,
ROUND(SUM(BYTES) / 1024 / 1024 / 1024, 2) TOTALSPACE
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME) DF,
(SELECT TABLESPACE_NAME,
ROUND(SUM(BYTES) / 1024 / 1024 / 1024, 2) FREESPACE
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) FS
WHERE DF.TABLESPACE_NAME = FS.TABLESPACE_NAME;