本人测试下来数据:
一张150个字段的表导入10万条记录
用普通的INSERT语句插入,耗时538s
换成SQL Loader以后,耗时70s。
可以节省相当多的时间!
SQL Loader使用入门(通过例子教你,通俗易懂):
http://www.oracle-dba-online.com/sql_loader.htm
http://www.thegeekstuff.com/2012/06/oracle-sqlldr/
命令:
sqlldr userid=user/pass@sid control=/export0/home/xx.ctl log=/export0/home/xx.log
另附一个自动生成SQL Loader ctl文件的方法:
运行以下SQL即可
select 'LOAD DATA APPEND INTO TABLE ' || '&TABLE_NAME' || ' FIELDS TERMINATED BY "," TRAILING NULLCOLS (' "Column Name",' ' "sql_loader_type" from dual union all select COLUMN_NAME, DECODE(DATA_TYPE, 'TIMESTAMP(6)','TIMESTAMP "YYYY-MM-DD HH24:MI:SS.FF",', 'NUMBER','DECIMAL EXTERNAL,', 'VARCHAR2','CHAR,', 'CHAR','CHAR', 'DATE','"TO_DATE(SUBSTR(:' || column_name || ',1,19),''YYYY-MM-DD HH24:MI:SS'')",' ) "sql_loader_type" from ( select * from all_tab_cols where owner=UPPER('&SCHEMA_NAME') AND TABLE_NAME = UPPER('&TABLE_NAME') order by column_id) union all select ')' "Column Name" , '' "sql_loader_type" from dual
运行完把结果拷贝出来再加工一下即可。