dbload 工具将数据从一个或多个文本文件传送到一个或多个现有表中。 dbload 工具使用灵活,但没有其他方法快,并且必须准备一个命令文件来控制输 入。dbload 的优势在于可分批提交需要导入的数据,从而避免长事务的发生。
以下示例将文本数据 test.unl 导入 test 表中,将 test1.unl 导入到 test1 表中, test 表列数为 2,test1 列数为 5。数据库名为 testdb,每次提交 10000 行,错误输 出到 err.log
示例:
dbload -d testdb -c f.cmd -l err.log -n 10000
f.cmd 文件:
file test.unl delimiter '|' 2;
insert into test;
file test1.unl delimiter '|' 5;
insert into test1;
test.unl 文件:
1|good|
2|good|
…