首页 > 代码库 > 【Oracle】表空间容量修改

【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_BYTES11 FROM SYS.DBA_FREE_SPACE12 GROUP BY TABLESPACE_NAME) F,13 (SELECT DD.TABLESPACE_NAME,14 ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MB15 FROM SYS.DBA_DATA_FILES DD16 GROUP BY DD.TABLESPACE_NAME) D17 WHERE D.TABLESPACE_NAME = F.TABLESPACE_NAME18 ORDER BY 4 DESC;

 

 

-- 查看表空间物理位置及运行状态SELECT T.TABLESPACE_NAME,D.FILE_NAME,D.AUTOEXTENSIBLE,D.BYTES,D.MAXBYTES,D.STATUSFROM DBA_TABLESPACES T,DBA_DATA_FILES DWHERE T.TABLESPACE_NAME =D.TABLESPACE_NAMEORDER 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;--- 直接修改表空间容量为100Galter database datafile E:\ORACLE\PRODUCT\10.2.0\ORADATA\MYL_DW_DATA_01.DBF resize 102400m; --- 100G容量