【Oracle】表空间容量修改
1 -- 查看表空间容量 2 SELECT UPPER(F.TABLESPACE_NAME) "表空间名", 3 D.TOT_GROOTTE_MB "表空间大小(M)", 4 D.TOT_GROOTTE_MB - F.TOTAL_BYTES "已使用空间(M)", 5 TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100,2),'990.99') "使用比", 6 F.TOTAL_BYTES "空闲空间(M)", 7 F.MAX_BYTES "最大块(M)" 8 FROM (SELECT TABLESPACE_NAME, 9 ROUND(SUM(BYTES) / (1024 * 1024), 2) TOTAL_BYTES, 10 ROUND(MAX(BYTES) / (1024 * 1024), 2) MAX_BYTES 11 FROM SYS.DBA_FREE_SPACE 12 GROUP BY TABLESPACE_NAME) F, 13 (SELECT DD.TABLESPACE_NAME, 14 ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MB 15 FROM SYS.DBA_DATA_FILES DD 16 GROUP BY DD.TABLESPACE_NAME) D 17 WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME 18 ORDER BY 4 DESC;
-- 查看表空间物理位置及运行状态 SELECT T.TABLESPACE_NAME,D.FILE_NAME, D.AUTOEXTENSIBLE,D.BYTES,D.MAXBYTES,D.STATUS FROM DBA_TABLESPACES T,DBA_DATA_FILES D WHERE T.TABLESPACE_NAME =D.TABLESPACE_NAME ORDER BY TABLESPACE_NAME,FILE_NAME;
--- 每次扩展大小 ALTER DATABASE DATAFILE 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\MYL_DW_DATA_01.DBF' AUTOEXTEND ON NEXT 500M MAXSIZE UNLIMITED; --- 直接修改表空间容量为100G alter database datafile 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\MYL_DW_DATA_01.DBF' resize 102400m; --- 100G容量