ora-01653資料表空間擴充失敗產生的情境和處理方法,ora-01653處理方法
產生ora-01653資料表空間擴充失敗的過程:
DBF放在E盤且E盤只有剩餘的200M
--1.建表
DROP TABLE bigtab;
CREATE TABLE bigtab AS SELECT rownum as "id", a.* FROM dba_objects a;
DROP TABLE smalltab;
create table smalltab as select rownum as "id", a.* FROM dba_tables a;
--2.增加資料
DECLARE
n NUMBER;
BEGIN
FOR n IN 1..100
LOOP
INSERT INTO bigtab SELECT rownum as "id", a.* FROM dba_objects a;
END LOOP;
COMMIT;
END;
//ora-01653異常出現。
處理辦法:
先清空E盤空間到2G
查:dbf空間是否是自動成長。
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;SELECT UPPER(F.TABLESPACE_NAME) "資料表空間名",D.TOT_GROOTTE_MB "資料表空間大小(M)",D.TOT_GROOTTE_MB - F.TOTAL_BYTES "已使用空間(M)",TO_CHAR(ROUND((D.TOT_GROOTTE_MB - F.TOTAL_BYTES) / D.TOT_GROOTTE_MB * 100,2),'990.99') "使用比",F.TOTAL_BYTES "空閑空間(M)",F.MAX_BYTES "最大塊(M)"FROM (SELECT TABLESPACE_NAME,ROUND(SUM(BYTES) / (1024 * 1024), 2) TOTAL_BYTES,ROUND(MAX(BYTES) / (1024 * 1024), 2) MAX_BYTESFROM SYS.DBA_FREE_SPACEGROUP BY TABLESPACE_NAME) F,(SELECT DD.TABLESPACE_NAME,ROUND(SUM(DD.BYTES) / (1024 * 1024), 2) TOT_GROOTTE_MBFROM SYS.DBA_DATA_FILES DDGROUP BY DD.TABLESPACE_NAME) DWHERE D.TABLESPACE_NAME = F.TABLESPACE_NAMEORDER BY 4 DESC;
確定後,執行:
ALTER DATABASE DATAFILE 'E:\DATA_DATA.DBF' AUTOEXTEND ON NEXT 50M MAXSIZE UNLIMITED
解決。