防止缓存被充满而无法导入[@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/
本文介绍如何使用dbload命令解决从文本文件导入大量数据到Informix数据库时遇到的缓存不足问题。通过设置每次提交的数据条数等参数,避免缓存被充满导致的导入失败。
1698

被折叠的 条评论
为什么被折叠?



