ORA-22924: snapshot too old

Bu hatanın nedeni bozulmuş lob alanlarından dolayıdır.( Corrupted Lobs ) ORA-1555 hatasıyla benzer gibi görünsede farklıdır.Bu bozulmuş alanları bulup tablodan silmemiz gerekmektedir.

alter session set current_schema=&SCHEMA_NAME;

-- Create corrupt_lobs table
create table corrupt_lobs (corrupt_rowid rowid, err_num number);

-- Find Corrupted Lobs and Write to corrupt_lobs table
declare
  error_1578 exception;
  error_1555 exception;
  error_22922 exception;
  pragma exception_init(error_1578,-1578);
  pragma exception_init(error_1555,-1555);
  pragma exception_init(error_22922,-22922);
  n number;
begin
  for cursor_lob in (select rowid r, &LOB_FIELD_NAME from &TABLE_NAME) loop
  begin
    n:=dbms_lob.instr(cursor_lob.&LOB_FIELD_NAME,hextoraw('889911'));
  exception
    when error_1578 then
      insert into corrupt_lobs values (cursor_lob.r, 1578);
      commit;
    when error_1555 then
      insert into corrupt_lobs values (cursor_lob.r, 1555);
      commit;
    when error_22922 then
      insert into corrupt_lobs values (cursor_lob.r, 22922);
      commit;
    end;
  end loop;
end;
/

-- List rows of Courupted Lobs 
select * from &SCHEMA_NAME.&TABLE_NAME where rowid in (select corrupt_rowid from corrupt_lobs);


-- Update Corrupted lobs with empty_blob() or empty_clob()
update &TABLE_NAME set &LOB_FIELD_NAME = empty_blob() where rowid in (select corrupt_rowid from corrupt_lobs);
commit;

Yorum Gönder

Daha yeni Daha eski