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

防止缓存被充满而无法导入[@more@]
informix 从文本导入海量数据(informix load)
从文本导入数据到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 remotedb -c load.cmd -l error.log -n 100000;

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

-----------------
#功能:
#从文件导入海量数据到informix数据库中
#主要是解决海量数据导入问题,当直接使用形如:
#load from prepay.dat insert into prepay;
#导入数据时,如果数据超过几百万条则会使缓存被充满而无法导入
#
#input: nameDB nameTable dataFile
#注意:
#1.程序需要informix load 支持
#2.数据文件第行应以"|"结尾

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8007125/viewspace-1016679/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8007125/viewspace-1016679/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值