互联网服务Informix

导入数据到informix数据库问题

由于所要导入的数据较多,使用      load from '/databak/databak061231/2009expired_data.unl' insert into yjccplsjlb090729;         命令运行一段时间后,报locks不够。之后又试着网上说的通过脚本导入   ...显示全部
由于所要导入的数据较多,使用
      load from '/databak/databak061231/2009expired_data.unl' insert into yjccplsjlb090729;
         命令运行一段时间后,报locks不够。
之后又试着网上说的通过脚本导入
     dbload -d yjkyxxt -c load.cmd -l error.log -n 1000000;



load.cmd 文件内容:
-----------------
file "/databak/databak061231/2009expired_data.unl" delimiter "|" 14 ;
insert into yjccplsjlb090729;
命令运行报错 :
In INSERT statement number 1 of raw data file /databak/databak061231/2009expired_data.unl.
Row number 2 is bad.
1506|2009-01-12 09:51:15|10|2|1|B|??|??|?????|1????|0| |0||???????????|?????-???-12 11:12:13|0||||


Reached unexpected end of line while reading field

后将
load.cmd 文件内容:
-----------------
file "/databak/databak061231/2009expired_data.unl" delimiter "|" 14 ;        14改为20
insert into yjccplsjlb090729;
In INSERT statement number 1 of raw data file /databak/databak061231/2009expired_data.unl.
Row number 5 is bad.
1506|2009-01-12 09:51:15|10|2|1|B|??|??|?????|1????|0| |0||???????????|?????-???-12 11:12:13|0||||


Reached unexpected end of line while reading field

小弟对informix数据库不是很熟,希望各位大哥能多帮帮忙,指点一下。现在感觉完全没招了!!!!
在此谢谢大家!!!!!

这是在网上看到的资料
从文本导入数据到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;
-----------------
也许是我不会用,不知错在哪了 请高手指教!!!!收起
参与6

查看其它 5 个回答twt社区管理员的回答

twt社区管理员twt社区管理员网站运营经理TWT
如果是纯informix的问题,可以去我们的informixchina.net,里头都是搞informix的!
互联网服务 · 2011-01-19
浏览1811

回答者

twt社区管理员
网站运营经理TWT
擅长领域: 数据库服务器存储

twt社区管理员 最近回答过的问题

回答状态

  • 发布时间:2011-01-19
  • 关注会员:0 人
  • 回答浏览:1811
  • X社区推广