数据库
首页 > 数据库> > Oracle-expdp ora-1555

Oracle-expdp ora-1555

作者:互联网

1. 问题现象

QQ截图20200319182901

2. 分析处理

2.1 确认导出异常表是否包含lob column坏块

-- 1. 创建临时表存储坏块的lob对象
create table corrupt_lobs (corrupt_rowid rowid, err_num number);

-- 2. 查看表大对象字段名称
set lines 168 pages 99
col COLUMN_NAME for a32
col SEGMENT_NAME for a48
select COLUMN_NAME,SEGMENT_NAME from DBA_LOBS
where owner=upper('&&tab_owner') and TABLE_NAME=upper('&&tab_name');

-- 3. 查找corrupted LOBs 并插入临时表
set verify off;

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, COLUMN_NAME from DBA_LOBS where owner=upper('&&tab_owner') and TABLE_NAME=upper('&&tab_name')) loop
  begin
    n:=dbms_lob.instr(cursor_lob.COLUMN_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;
/

-- 4. 将 大字段列设置为空或是排除导出
SQL> update &&tab_owner.&&tab_name set &&lob_column = empty_blob()
     where rowid in (select corrupt_rowid from corrupt_lobs);
SQL> commit;

or

expdp <USER>/<PASSWORD> DIRECTORY=data_pump_dir DUMPFILE=<DUMP_NAME>.dmp LOGFILE=<LOG_NAME>.dmp.log TABLES=<SCHEMA_NAME>.<TABLE_NAME> QUERY=\"where rowid not in \(\'AAEWBsAAGAAACewAAC\', \'AAEWBsAAGAAACewAAF\', \'AAEWBsAAGAAACewAAG\'\)\" 

标签:lob,exception,expdp,NAME,corrupt,error,Oracle,1555
来源: https://www.cnblogs.com/binliubiao/p/12526490.html