SQL*Loader是oracle的高速批量数据加载工具。
这是一个非常有用的工具,可用于从多种平面文件格式向Oracle数据库中加载数据。
SQLLDR可以在极短的时间内加载数量庞大的数据。
INSERT 这是缺省方法。该方法假设在数据装载前表是空的,如果在表中有记录,SQLLDR退出,
并报:SQLLDR-601: FOR INSERT OPTION,TABLE MUST BE EMPTY,ERROR ON TABLE DEPT
APPEND这种方法允许记录被添加到数据库表中,而且不影响已经存在的记录
REPLACE 这种方法首先删除表中已经存在的记录,然后开始装载新的记录。
TRUNCATE 这种方法在装载数据前,使用SQL命令TRUNCATE 删除老的记录
1.
[oracle@o1 ~]$ vi a.ctl
load data
infile *
into table dept1
fields terminated by ','
(deptno,dname,name)
begindata
10,xiaoshou,zs
20,jishu,ls
30,shichang,ww
2.
[oracle@o1 bin]$ sqlplus scott/abc
SQL> create table dept1
(deptno int,dname varchar2(20),name varchar2(10));
3.
[oracle@o1 ~]$ sqlldr scott/lipengfei control=/home/oracle/a.ctl
SQL> select * from dept1;(内容已经插入)