Oracle SQL*Loader Segmentation Fault (core dumped)

05 July 2011

调试代码时在一个关于SQL*Loader的错误上折腾了好一阵,记录一下备忘:

错误信息:

$> sqlldr user_id/passwd@db_name control=control_file.ctl

SQL*Loader: Release 10.2.0.4.0 - Production on Tue Jul 5 01:20:09 2011
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
Segmentation Fault (core dumped)

其他类似的程序并没有发现这种错误。在进行了N种尝试后,发现问题存在于数据文件的文件名上:

LOAD DATA
INFILE 0701.T0.csv
APPEND INTO TABLE SAMPLE_TABLE
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(
COLUMN DEF ...
)

经测试,只要控制文件中INFILE选项后跟的文件名以数字开头,就会发生"Segmentation Fault (core dumped)"的错误。(Oracle的Bug?)

解决方法:

方法1. 最简单的方法,避免数据文件名以数字开头

方法2. 数据文件名加双引号:

LOAD DATA
INFILE “0701.T0.csv”
APPEND INTO TABLE SAMPLE_TABLE
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
TRAILING NULLCOLS
(
COLUMN DEF ...
)

方法3. CTL文件中不使用INFILE选项,在命令行中用data选项代替:

$> sqlldr user_id/passwd@db_name control=control_file.ctl data=0701.T0.csv

下一篇: 近千本Dropbox分享的Kindle中文电子书,持续更新中 →

blog comments powered by Disqus