當Oracle undo表空間滿了,可以通過以下步驟來清理:
SELECT tablespace_name, sum(bytes) / 1024 / 1024 AS "Undo Space (MB)"
FROM dba_undo_extents
GROUP BY tablespace_name;
SELECT r.name, t.xidusn, t.xidslot, t.xidsqn, t.start_time
FROM v$transaction t, v$session s, v$rollname r
WHERE t.addr = s.taddr
AND s.ses_addr = t.ses_addr
AND t.xidusn = r.usn;
ALTER SYSTEM KILL SESSION 'sid,serial#';
ROLLBACK;
ALTER DATABASE DATAFILE 'undo_datafile_path' RESIZE size;
CREATE UNDO TABLESPACE new_undo_ts DATAFILE 'new_undo_datafile_path' SIZE size;
注意:在執行以上操作之前,請務必備份重要數據,以避免數據丟失。