informix load问题
load from file insert into tbname;file较大,有些行格式不正确,无法正确导入。
目标:
执行load ,若某行不能导入,则跳过此行,并将此行写入到error.log
请求帮助。 用dbload工具吧~这个有这个功能。
注意下这个需要一个命令文件格式大概是:
file 'FILENAME' delimiter '|' FIELDNUM; insert into TABNAME;
FILENAME 文件名
FIELDNUM 字段数
TABNAME 表名
dbload里注意各参数含义
Usage:
dbload [-d dbname] [-c cfilname] [-l logfile] [-e errnum] [-n nnum]
[-i inum] [-s] [-p] [-r | -k] [-X]
-d database name
-c command file name
-l bad row(s) log file
-e bad row(s) # before abort
-s syntax error check only
-n # of row(s) before commit
-p prompt to commit or not on abort
-i # or row(s) to ignore before starting
-r loading without locking table
-X recognize HEX escapes in character fields
-k loading with exclusive lock on table(s)
回复 2# liaosnet
MS不能正确跳过并记录,之能打错误日志。 回复liaosnet
MS不能正确跳过并记录,之能打错误日志。
axengine 发表于 2010-12-09 13:24 http://bbs3.chinaunix.net/images/common/back.gif
你总得把你的操作写出来吧。。
具体语句。。特别是dbload完整命令。 回复 4# liaosnet
dbload -d $nameDB -c $loadCMDFile -l $errLog -n $commitNum -s >> $tmpFile 2>&1 -e bad row(s) # before abort 本帖最后由 axengine 于 2010-12-09 14:14 编辑
回复 6# liaosnet
ibm_p52a(cmbc)/cmbc/usr/lg/pno>dbload -d cmbc -c dbload.ctl -l error.log -e errFile -n 300 <
DBLOAD Load Utility INFORMIX-SQL Version 11.10.UC2W4
300 Row(s) loaded so far to table axeng.
600 Row(s) loaded so far to table axeng.
900 Row(s) loaded so far to table axeng.
In INSERT statement number 1 of raw data file xat.
Row number 953 is bad.
苂ht=||19|| ...
The # of fields in the load file does not match the # on the FILE line
dbload.ctl:
file "loadfile.txt" delimiter "|" 14 ;
insert into tabname; -e 后加的是允许出错的行数。。。。。
:em17::em17:
不是出错日志。。。-l 才是出错日志。。 -e 后加的是允许出错的行数。。。。。
不是出错日志。。。
liaosnet 发表于 2010-12-09 14:13 http://bbs.chinaunix.net/images/common/back.gif
出错的行数如何定?随意定一个,文本总数据大概2000W条。 Thank you ,liaosnet.
页:
[1]
2