暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

informix 从文本导入海量数据(dbload)

ibm软件技术联盟 2017-09-19
600

从文本导入数据到informix数据一般使用SQL语句:
load from file.dat insert into yourDB;
但当导入的数据有好几百万甚至上千万条时用上面的方法可能就会出错了,因为这样可能造成数据库缓存不足。
一个解决的办法是使用dbload命令,以下为dbload的参数说明:
#---------------------------------------------------------------------
#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)
#---------------------------------------------------------------------

下面举一简单例子:
数据库名:remotedb
load命令文件名:load.cmd
错误日志文件名:error.log
每次提交的数据条数:100000

数据文件名:prepay.dat
数据字段分隔符: “|”
每行数据的字段数据: 14
要插入的数据表名:prepay

应用命令如下:
dbload -d DBNAME -c load.cmd -l error.log -n 100000;

load.cmd 文件内容:
-----------------
file "prepay.dat" delimiter "|" 14 ;
insert into prepay;

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

文章转载自ibm软件技术联盟,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论