Thursday, November 6, 2014

ODBC error: (HY000) - [Oracle][ODBC][Ora]ORA-01555: snapshot too old: rollback segment number with name "" too small.

This isn't a real ORA-01555 issue where extending the UNDO tablespace will fix the issue, It is an actually LOB datatype corruption issue.


Running Oracle datapump  "expdp" on the schema will also reveal the table that has the corruption although it will not reveal the specific column:

  1. Identify if UNDO tablespace is enough to grow:

    col file_name format a60
    set pagesize 120
    set linesize 1000
    select file_id, file_name, round(bytes/1024/1024, 2) MB, status, autoextensible, round(maxbytes/1024/1024,2)  max_mb from dba_data_files where tablespace_name like upper ('UNDO%') order by file_id;


  2. Create a temporary table as place holder:

    create table corrupted_lob_data (corrupted_rowid rowid);


  3. Run the following procedure to catch the error 1555:

    set concat off
    declare
    error_1555 exception;
    pragma exception_init(error_1555,-1555);
    num number;
    begin
    for cursor_lob in (select rowid r, &&lob_column from &table_owner.&table_with_lob) loop
    begin
    num := dbms_lob.instr (cursor_lob.&&lob_column, hextoraw ('889911')) ;
    exception
    when error_1555 then
    insert into corrupted_lob_data values (cursor_lob.r);
    commit;
    end;
    end loop;
    end;
    /
    Enter value for

    lob_column: VALUE
    Enter value for table_owner: vpxadmin
    Enter value for table_with_lob: VPX_TEXT_ARRAY
    old 6: for cursor_lob in (select rowid r, &&lob_column from &table_owner.&table_with_lob) loop
    new 6: for cursor_lob in (select rowid r, VALUE from vpxadmin.VPX_TEXT_ARRAY) loop
    old 8: num := dbms_lob.instr (cursor_lob.&&lob_column, hextoraw ('889911')) ;
    new 8: num := dbms_lob.instr (cursor_lob.VALUE, hextoraw ('889911')) ;
    PL/SQL procedure successfully completed.




  4. Take a look at the placeholder table for corrupted rowid. You might have more than one rows.

    SQL> select * from corrupted_lob_data;

    CORRUPTED_ROWID
    ------------------
    AAB7XAAAGAAEFjwAAC


  5. To confirm if the row/s associated were really corrupted. Do this in SQLPLUS and it should error out the same way as it happens in the VCD log states. Note: DO NOT use SQLDEVELOPER to track this, it will not produced the exact error since it skip the contents of the LOB column.

    Select * from vpx_text_array where rowid=’AAB7XAAAGAAEFjwAAC’


This blog will take you as far as tracking the corrupted cells.

No comments:

Post a Comment