oracle exp 包含blob,exp blob ora-01555 另附其他问题

用户导出一个表,出现如下错误

exp spscase/spscase@spsdevtables=(PRINT_TEMPLATE) compress = y file=F:oracleora_dumppintTemplate.dmp log=F:oracleora_dumppintTemplate.log

具体报错信息:

About to export specified tables via Conventional Path ...

. . exporting tablePRINT_TEMPLATE

EXP-00056: ORACLE error 1555 encountered

ORA-01555: snapshot too old: rollback segment numberwith name "" too small

ORA-22924: snapshot too old

Export terminated successfully with warnings.

在解决问题的过程中,先后出现了几个问题。

一.从本地client尝试导出,发现:

exp spscase/spscase@spsdevtables=(PRINT_TEMPLATE) compress = y file=c:aa.dmp

即将导出指定的表通过常规路径...

. .正在导出表PRINT_TEMPLATE

EXP-00008:遇到ORACLE错误904

ORA-00904: "IFREEPOOL":标识符无效

导出成功终止,但出现警告。

这是因为版本不一致导致的,在遇到包含LOB对象的表时触发,这是因为10.2.0.4中,管理LOB对象发生了变化,在字典中引入了一些新的字段,如'IFREEPOOL'.

10.2.0.3中不包含相应字段,在EXP时就出现了错误。

在Metalink上的Note:726182.1中,Oracle指出:Client 10.2.0.4.0 is not supported to export from 10.2.0.3.0 database。

也就是说使用10.2.0.4的客户端导出10.2.0.3不被支持,也没有Workaround,我们应当使用匹配的版本来执行导出工作

Applies to:

Oracle Server - Enterprise Edition - Version: 10.2.0.3 to 10.2.0.4

This problem can occur on any platform.

Symptoms

Export reports ORA-00904 "IFREEPOOL": invalid identifier while using a version 10.2.0.4.0 export client to export from a 10.2.0.3.0 database.

Export Log File

---------------

. . Export der Tabelle CALCULATEDFIELDS

EXP-00008: ORACLE-Fehler 904 aufgetreten

ORA-00904: "IFREEPOOL": invalid identifier

Cause

This is an expected behaviour.

The version of the Export utility must be equal to the earliest version of the source or target database. Here, the source database is based on release 10.2.0.3.0 and hence the export client has to be a version 10.2.0.3.0.

An export client of a later release cannot be used for the following reasons:

·The export utility is continuously accessing dictionary objects such as SYS.EXU9LOB.

·Starting with release 10.2.0.4.0 we introduced additional columns such as 'IFREEPOOL'. This column is not available in 10.2.0.3.0 and hence the client cannot handle this and ORA-00904/EXP-00008 appears.

Client 10.2.0.4.0 is not supported to export from 10.2.0.3.0 database.

Solution

FIX

The version of the Export utility must be equal to the earliest version of the source or target database.

WORKAROUND

None. - This is an expected behaviour

后从Server段执行,该问题消失

二。尝试用query方式导出

SQL> desc print_template

NameTypeNullable Default Comments

-------------- ------------- -------- ------- --------

TEMPLATE_IDNUMBER(8)

TEMPLATE_NAMEVARCHAR2(32)

TEMPLATE_VALBLOBY

STSCHAR(1)

STS_DATEDATE

DSCOUNTNUMBER(4)

TEMPLATE_PRINT BLOBY

ACTION_IDNUMBER(12)Y

REMARKSVARCHAR2(512) Y

TEMPLATE_CODEVARCHAR2(64)Y

STAFF_IDNUMBER(12) Y

LOCAL_NET_IDNUMBER(6)Y

发现该表用2个BLOB段。另外此表共有132行数据,导出时发现在40多行开始抱错,决定每次导出40行处理。

在windows端需作如下处理

exp spscase/spscase@spsdevtables=PRINT_TEMPLATE file=1.dmp

query='where TEMPLATE_ID in

( select TEMPLATE_ID

from ( select rownum row_n,TEMPLATE_ID

from print_template

where rownum"

)t where row_n">"=1

)'

。。。

exp spscase/spscase@spsdevtables=PRINT_TEMPLATE file=3.dmp

query='where TEMPLATE_ID in

( select TEMPLATE_ID

from ( select rownum row_n,TEMPLATE_ID

from print_template

where rownum"

)t where row_n">"=81

)'

后发现客户是AIX,遂改为:

exp spscase/spscase@spsdevtables=PRINT_TEMPLATE file=1.dmp

query="where TEMPLATE_ID in

(select TEMPLATE_ID

from ( select rownum row_n,TEMPLATE_ID

from print_template where rownum<41

)t

where row_n>=1

)"

这样,用户可以导出。

因为在where条件中一般都会有空格,而命令行下就会被释成几个命令行参数,需要用单引号或双引号将整个where条件括起来,就可以了.在Windows下,如何指定query参数:

exp … query=’where deptno=10′

exp … query=’where deptno=”10”’

exp … query=’where deptno”

在Solaris(C shell)下,如何指定query参数:

exp ….. query=”where col1 < 1000”

exp ….. query=”where col1 < ‘1000′”

不过最好是写在一个参数文件里,这样的话就不用注意这些了

第三。继续check

用户再导入时,发现第二个dmp用不了,这样想来,就是在40多行的时候出现的问题,后用editplus直接打开dmp文件,果然发现很多乱码。

Metalink提到如果exp遇到ora-1555错误的时候,是由于记录集中有损坏的记录导致。

后查询metalink 787004.1EXP ORA-01555 ORA-22924 ORA-01578 ORA-22922

利用其中提供的脚本,查询原表发现

create table corrupt_lobs (corrupt_rowid rowid);

declareerror_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;beginfor cursor_lob in (select rowid r, document from LOBDATA ) loopbeginn:=dbms_lob.instr(cursor_lob.document,hextoraw('889911'));exceptionwhen error_1578 theninsert into corrupt_lobs values (cursor_lob.r);commit;when error_1555 theninsert into corrupt_lobs values (cursor_lob.r);commit;when error_22922 theninsert into corrupt_lobs values (cursor_lob.r);commit;end;end loop;end;/select * from corrupt_lobs;

发现有三行记录报错。

后单独对这三行记录导出,仍然出现ora-1555错误。

exp ***** tables=print_template query="where template_id in (100018,100033,100051)"

Oracle提到这种记录只能恢复或者,请空该字段。

update PRINT_TEMPLATE set TEMPLATE_VAL = empty_blob()where rowid in (select corrupt_rowid from corrupt_lobs);

交给程序员处理吧还是。

[@more@]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值