load.sh 文本文件 导入表名
#!/bin/ksh echo $1 $2 cat $1|wc -l>>file.txt #按每10000条记录分割一个文件 split -l 10000 $1 $2_ ls $2_* >file2.txt for i in `cat file2.txt` do # 数据库被置为无日志状态时,SQL语句不用加事务. echo "begin work;load from $i insert into $2;commit work;">file3.sql dbaccess dbsname file3.sql rm -rf $i done #比较导入文本记录与导入后的记录数是否一致 echo "select count(*) from $2;" >count.sql dbaccess dbsname count.sql>>file.txt #rm temp file rm -f file2.txt count.sql file3.sql