首页 > 数据库 > Oracle > exp blob ora-01555 另附其他问题
用户导出一个表,出现如下错误
exp spscase/spscase@spsdev tables=(PRINT_TEMPLATE) compress = y file=F:oracleora_dumppintTemplate.dmp log=F:oracleora_dumppintTemplate.log
具体报错信息:
About to export specified tables via Conventional Path ...
. . exporting table PRINT_TEMPLATE
EXP-00056: ORACLE error 1555 encountered
ORA-01555: snapshot too old: rollback segment number with name "" too small
ORA-22924: snapshot too old
Export terminated successfully with warnings.
在解决问题的过程中,先后出现了几个问题。
一.从本地client 尝试导出,发现:
exp spscase/spscase@spsdev tables=(PRINT_TEMPLATE) compress = y file=c:aa.dmp
即将导出指定的表通过常规路径...
. . 正在导出表 PRINT_TEMPLATE
EXP-00008: 遇到 ORACLE 错误 904
ORA-00904: "IFREEPOOL": 标识符无效
导出成功终止, 但出现警告。
这是因为版本不一致导致的,在遇到包含LOB对象的表时触发,这是因为
在Metalink上的Note:726182.1中,Oracle指出:Client
也就是说使用
Applies to:
Oracle Server - Enterprise Edition - Version:
This problem can occur on any platform.
Export reports ORA-00904 "IFREEPOOL": invalid identifier while using a version
Export Log File
---------------
. . Export der Tabelle CALCULATEDFIELDS
EXP-00008: ORACLE-Fehler 904 aufgetreten
ORA-00904: "IFREEPOOL": invalid identifier
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
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
Client 10.2.0.4.0 is not supported to export from 10.2.0.3.0 database.
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
Name Type Nullable Default Comments
-------------- ------------- -------- ------- --------
TEMPLATE_ID NUMBER(8)
TEMPLATE_NAME VARCHAR2(32)
TEMPLATE_VAL BLOB Y
STS CHAR(1)
STS_DATE DATE
DSCOUNT NUMBER(4)
TEMPLATE_PRINT BLOB Y
ACTION_ID NUMBER(12) Y
REMARKS VARCHAR2(512) Y
TEMPLATE_CODE VARCHAR2(64) Y
STAFF_ID NUMBER(12) Y
LOCAL_NET_ID NUMBER(6) Y
发现该表用2个BLOB段。另外此表共有132行数据,导出时发现在40多行开始抱错,决定每次导出40行处理。
在windows 端需作如下处理
exp spscase/spscase@spsdev tables=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
)'
。。。
exp spscase/spscase@spsdev tables=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"<"121
)t where row_n">"=81
)'
后发现客户是AIX,遂改为:
exp spscase/spscase@spsdev tables=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=”
exp … query=’where deptno”<"10'
在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.1 EXP ORA-01555 ORA-22924 ORA-01578 ORA-22922
利用其中提供的脚本,查询原表发现
create table corrupt_lobs (corrupt_rowid rowid);
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, document from LOBDATA ) loop begin n:=dbms_lob.instr(cursor_lob.document,hextoraw('889911')); exception when error_1578 then insert into corrupt_lobs values (cursor_lob.r); commit; when error_1555 then insert into corrupt_lobs values (cursor_lob.r); commit; when error_22922 then insert 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@]
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/256370/viewspace-1026200/ ,如需转载,请注明出处,否则将追究法律责任。