SELECT A.TABLESPACE_NAME TABLESPACE_NAME, NVL(CEIL((1 - B.FREE / A.TOTAL) * 100),
100) "usage_of_tablespace%", NVL(B.FREE, 0) "left_space(M)", C.EXTENT_MANAGEMENT "Extent_management"
FROM (SELECT TABLESPACE_NAME, SUM(NVL(BYTES, 0)) / 1024 / 1024 TOTAL
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME) A, (SELECT TABLESPACE_NAME, SUM(NVL(BYTES, 0)) / 1024 / 1024 FREE
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) B, DBA_TABLESPACES C
WHERE A.TABLESPACE_NAME = C.TABLESPACE_NAME AND
C.TABLESPACE_NAME = B.TABLESPACE_NAME(+);
SELECT A.TABLESPACE_NAME 表空间名, NVL(CEIL((1 - B.FREE / A.TOTAL) * 100),
100) "使用占比%", NVL(B.FREE, 0) "剩余空间(M)", C.EXTENT_MANAGEMENT "Extent_management"
FROM (SELECT TABLESPACE_NAME, SUM(NVL(BYTES, 0)) / 1024 / 1024 TOTAL
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME) A, (SELECT TABLESPACE_NAME, SUM(NVL(BYTES, 0)) / 1024 / 1024 FREE
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) B, DBA_TABLESPACES C
WHERE A.TABLESPACE_NAME = C.TABLESPACE_NAME AND
C.TABLESPACE_NAME = B.TABLESPACE_NAME(+);
SELECT FILE_ID, FILE_NAME, TABLESPACE_NAME, STATUS, BYTES / 1024 / 1024 AS "bytes MB"
FROM DBA_DATA_FILES
SELECT TBS 表空间名, SUM(TOTALM) 总共大小M, SUM(USEDM) 已使用空间M, SUM(REMAINEDM) 剩余空间M, SUM(USEDM) / SUM(TOTALM) * 100 已使用百分比, SUM(REMAINEDM) / SUM(TOTALM) * 100 剩余百分比
FROM (
SELECT B.FILE_ID ID, B.TABLESPACE_NAME TBS, B.FILE_NAME NAME, B.BYTES / 1024 / 1024 TOTALM, (B.BYTES - SUM(NVL(A.BYTES, 0))) / 1024 / 1024 USEDM, SUM(NVL(A.BYTES, 0) / 1024 / 1024) REMAINEDM, SUM(NVL(A.BYTES, 0) / (B.BYTES) * 100), (100 - (SUM(NVL(A.BYTES, 0)) / (B.BYTES) * 100))
FROM DBA_FREE_SPACE A, DBA_DATA_FILES B
WHERE A.FILE_ID = B.FILE_ID GROUP BY B.TABLESPACE_NAME, B.FILE_NAME, B.FILE_ID, B.BYTES
ORDER BY B.TABLESPACE_NAME
) GROUP BY TBS
ALTER DATABASE DATAFILE 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\GEODB\SYSTEM01.DBF'RESIZE 1000m
ALTER DATABASE DATAFILE 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\GEODB\SYSAUX01.DBF'RESIZE 1000m
ALTER DATABASE DATAFILE 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\GEODB\SYSTEM01.DBF'RESIZE 1000m
ALTER DATABASE DATAFILE 'D:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\SXGEOINFO.ORA'RESIZE 100m
ALTER DATABASE DATAFILE 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\GEODB\USERS01.DBF'RESIZE 10m
ALTER DATABASE DATAFILE 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\GEODB\SYSTEM01.DBF'RESIZE 1000m
ALTER DATABASE DATAFILE 'D:\ORACLE\PRODUCT\10.2.0\DB_1\DATABASE\GISDB3.ORA'RESIZE 100m
–查看表空间使用情况:
SELECT A.TABLESPACE_NAME "表空间名",
TOTAL "表空间大小",
FREE "表空间剩余大小",
(TOTAL - FREE) "表空间使用大小",
TOTAL / (1024 * 1024 * 1024) "表空间大小(G)",
FREE / (1024 * 1024 * 1024) "表空间剩余大小(G)",
(TOTAL - FREE) / (1024 * 1024 * 1024) "表空间使用大小(G)",
ROUND((TOTAL - FREE) / TOTAL, 4) * 100 "使用率 %"
FROM (SELECT TABLESPACE_NAME, SUM(BYTES) FREE
FROM DBA_FREE_SPACE
GROUP BY TABLESPACE_NAME) A,
(SELECT TABLESPACE_NAME, SUM(BYTES) TOTAL
FROM DBA_DATA_FILES
GROUP BY TABLESPACE_NAME) B
WHERE A.TABLESPACE_NAME = B.TABLESPACE_NAME;