ORA-30036: 无法将撤消表空间中的段扩展 8 'UNDOTBS'

ORA-30036: unable to extend segment by 8 in undo tablespace 'UNDOTBS'

我正在 运行ning cron 作业,其中包含以下 PL/SQL 块:

declare  
  begin  
--insert into DB_LOGS_TEMP table from DB_LOGS table  
INSERT INTO DB_LOGS_TEMP SELECT * FROM DB_LOGS WHERE DB_LOG_ID NOT IN(SELECT DB_LOG_ID from DB_LOGS_TEMP );  
--keep the lat 10 records and delete other records  
DELETE DB_LOGS where rowid  in (  
select rid from (  
select t.rowid rid,  
       row_number() over(partition by T.DB_LOG_ID order by T.TIMESTAMP desc) as rn  
from DB_LOGS t)  
where rn > 10);  
end;  

DB_LOGS table 有 10247302 行。当 cron 作业 运行 时,它会抛出错误 ORA-30036: unable to extend segment by 8 in undo tablespace 'UNDOTBS'。增加 tablespce 是解决此问题的唯一方法吗?如何解决? UNDOTBS 有 524288000 字节。

如果你能负担得起在不同事务中删除:

DECLARE
  i PLS_INTEGER;
BEGIN
  --insert into DB_LOGS_TEMP table from DB_LOGS table
  INSERT INTO DB_LOGS_TEMP
  SELECT *
  FROM DB_LOGS
  WHERE DB_LOG_ID NOT IN
    (SELECT DB_LOG_ID FROM DB_LOGS_TEMP
    );
  COMMIT;
  i:=50;
  --keep the lat 10 records and delete other records
  WHILE i>=10
  LOOP
    DELETE DB_LOGS
    WHERE rowid IN
      (SELECT rid
      FROM
        (SELECT t.rowid rid,
          row_number() over(partition BY T.DB_LOG_ID order by T.TIMESTAMP DESC) AS rn
        FROM DB_LOGS t
        )
      WHERE rn > i
      );
    COMMIT;
    i:=i-5;
  END LOOP;
END;

它对我有用,同时增加了表空间并启用了自动扩展。

 ALTER DATABASE DATAFILE '/vg01lv11/oracle//data/undotbs_d1_O2P00R11.dbf' AUTOEXTEND ON MAXSIZE 10g;

ALTER DATABASE DATAFILE '/vg01lv11/oracle//data/undotbs_d1_O2P00R11.dbf'
       RESIZE 1000M;