博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
A bug of "sql*loader"?
阅读量:4620 次
发布时间:2019-06-09

本文共 4139 字,大约阅读时间需要 13 分钟。

A very interesting problem popped up when tried to load LOB data into table using "sql*loader". Here is the story....

 

Table:

DB_FILES_FERMAT

SQL> desc db_files_fermat Name                                      Null?    Type ----------------------------------------- -------- ---------------------------- ID                                        NOT NULL NUMBER(10) FILENAME                                           VARCHAR2(512 CHAR) DESCRIPTION                                        VARCHAR2(4000 CHAR) DATA                                               BLOB SYNCHRONIZE_FILE                                   CHAR(1 CHAR) FILE_TIMESTAMP                                     DATE DB_TIMESTAMP                                       DATE FILE_TYPE                                          VARCHAR2(10 CHAR)SQL>

 CTL File:

DB_FILES_FERMAT.CTL

OPTIONS (SILENT=(HEADER, FEEDBACK), DIRECT=FALSE)LOAD DATACHARACTERSET UTF8LENGTH SEMANTICS CHARBYTEORDERMARK CHECKINFILE 'DB_FILES_FERMAT.DAT' "STR '#$EOR$#\r\n'"APPENDINTO TABLE DB_FILES_FERMATFIELDS  TERMINATED  BY ',' OPTIONALLY ENCLOSED BY '"' AND '"'TRAILING NULLCOLS(ID "SEQ_DB_FILES.NEXTVAL",FILENAME CHAR(512) "TO_CHAR(:FILENAME)",DESCRIPTION CHAR(4000) "TO_CHAR(SUBSTR(:DESCRIPTION,1,2000))||TO_CHAR(SUBSTR(:DESCRIPTION,2001))",DATA LOBFILE(FILENAME) TERMINATED BY EOF,SYNCHRONIZE_FILE CHAR(1) "TO_CHAR(:SYNCHRONIZE_FILE)",FILE_TIMESTAMP DATE "YYYY-MM-DD HH24:MI:SS",DB_TIMESTAMP DATE "YYYY-MM-DD HH24:MI:SS",FILE_TYPE CHAR(10) "TO_CHAR(:FILE_TYPE)")

 

Please note that the column "DATA" will be loaded from the out-of-the-line lob file -- "LOBFILE(FILENAME)"

 

Data File:

 DB_FILES_FERMAT.DAT (partial content)

,"EXPFBI_CATALOG@RFO_CUBES.MIG","RFO_CUBES","",,,"MIG"#$EOR$#,"EXPFBI_CATALOG_REFERENCE@RFO_CUBES.MIG","RFO_CUBES","",,,"MIG"#$EOR$#,"EXPMIGRATION_DEF@RFO_CUBES.MIG","RFO_CUBES","",,,"MIG"#$EOR$#,"EXPMIGRATION_EXPORTED_TABLES_TMP@RFO_CUBES.MIG","RFO_CUBES","",,,"MIG"#$EOR$#

 

 Please note that the file names -- "EXPFBI_CATALOG@RFO_CUBES.MIG" and the like, those binary files will be read and loaded into the column "DATA" in the table DB_FILES_FERMAT. Those MIG files are put under the same folder as DB_FILES_FERMAT.DAT...

 

Weird Problems Occur 

When tried to run "sqlldr" to load the data, the following error messages pop up...

SQL*Loader-502: unable to open data file 'EXPFBI_CATALOGdbciRFO_CUBES.MIG' for field DATA table DB_FILES_FERMATSQL*Loader-553: file not foundSQL*Loader-509: System error: The system cannot find the file specified.SQL*Loader-502: unable to open data file 'EXPFBI_CATALOG_REFERENCEdbciRFO_CUBES.MIG' for field DATA table DB_FILES_FERMATSQL*Loader-553: file not foundSQL*Loader-509: System error: The system cannot find the file specified.SQL*Loader-502: unable to open data file 'EXPMIGRATION_DEFdbciRFO_CUBES.MIG' for field DATA table DB_FILES_FERMATSQL*Loader-553: file not foundSQL*Loader-509: System error: The system cannot find the file specified.SQL*Loader-502: unable to open data file 'EXPMIGRATION_EXPORTED_TABLES_TMPdbciRFO_CUBES.MIG' for field DATA table DB_FILES_FERMATSQL*Loader-553: file not foundSQL*Loader-509: System error: The system cannot find the file specified.SQL*Loader-502: unable to open data file 'EXPMIGRATION_SETdbciRFO_CUBES.MIG' for field DATA table DB_FILES_FERMATSQL*Loader-553: file not found……

 

 

It’s quite weird that “sql*loader” replace the character “@” with “dbci” when processing those MIG files!  “dbci” is actually one “active” oracle instance in the machine I ran the sqlldr. Then I tried to run the sql*loader in another machine, this time the error messages changed to like “sql*loader is unable to open ‘'EXPMIGRATION_EXPORTED_TABLES_TMPprimaryRFO_CUBES.MIG”. Note the primary is the “active” oracle instance in that machine.  However, after shutting down the oracle instances on that machine, it ran successfully! 

 

After such experiments, I suspected it to be one “sql*loader” bug. It might interpret “@” specially. So I tried to change the file name to replace “@” with “#”, this time it worked as well!

 

Quite a stange problem. A sqlldr bug? 

 

 

 

转载于:https://www.cnblogs.com/fangwenyu/archive/2012/04/26/2471612.html

你可能感兴趣的文章
Java中的抽象类
查看>>
关于Altium Designer的BOM,元件清单
查看>>
使用MongoDB ruby驱动进行简单连接/CRUD/运行命令
查看>>
关于set和multiset的一些用法
查看>>
基础训练 芯片测试
查看>>
如何用命令将本地项目上传到git
查看>>
JavaScript 实现鼠标拖动元素
查看>>
js 模糊查询 (360接口)
查看>>
python+rabbitMQ实现生产者和消费者模式
查看>>
“模态”对话框和“后退”按钮
查看>>
关于javascript实现的网站页面侧边悬浮框"抖动"问题
查看>>
linux_命令格式和命令提示符
查看>>
Cocos2d-X-3.0之后的版本的环境搭建
查看>>
when case group by 的用法集合
查看>>
认识XmlReader
查看>>
JAVA学习Swing章节标签JLabel中图标的使用
查看>>
sqlserver,oracle,mysql等的driver驱动,url怎么写
查看>>
局部变量和static变量的区别
查看>>
IE下iframe不能正常加载,显示空白
查看>>
mysql服务性能优化—my.cnf配置说明详解
查看>>