1. Create a table:
Sql> conn Scott/[email protected];
is connected.
Sql> CREATE TABLE EMP2 as SELECT * from EMP WHERE 1=2;
The table is created.
Sql> SELECT * from EMP2;
Row not selected
====================
2. Import data in control file mode
= = Write Control file:
Save As: D:\oracletest\testSqlLdr1.ctl
LOADDatainfile* into TABLEemp2fileds TERMINATED by"," (Empn0,ename,job,sal,comm,deptno) Begindata1111, RUSKY1,DBA1,6000, -, -1112, RUSKY2,DBA2,7000, $,Ten1113, Rusky2,dba3,8000, -, -
= = Execution Control file
C:\Users\Administrator>Sqlldr SCOTT/Tiger CONTROL=D:\oracletest\testSqlLdr1.ctlSQL*Loader:release11.2.0.1.0 -Production onSunday November - A: -:Geneva theCopyright (c)1982, the, Oracleand/orits affiliates. Allrights reserved. Reach the submission point-Logical Record Count2Reach submission Point-Logical Record Count3
= = Query Result:
Sql> Select * fromEMP2; EMPNO ename JOB MGR hiredate SAL COMM DEPTNO---------- ---------- --------- ---------- -------------- ---------- ---------- ----------1111RUSKY1 DBA16000 - -1112RUSKY2 DBA27000 $ Ten1113RUSKY2 DBA38000 - -
======================================================================
3. Control Document Description:
LOADDATA--control files generally start with someINFILE* --* Indicates the data is in the current control file, if there is a separate data file, you need to indicate the location of the data file. into TABLEEMP2/*the table to which to import. Available parameters before into: Insert (default) Inserts data into the table, the table must be empty, and if not empty, an error occurs when executing sqlldr. APPEND: Append data, regardless of whether there is data in the table. Replace: Replaces all data in the table with respect to the first delete table, and then inserts. TRUNCATE: Clears the data in the table by TRUNCATE, and then inserts. */fileds TERMINATED by","--set Data part string delimiter(Empn0,ename,job,sal,comm,deptno)--the name of the table column to insert. The order of the columns can be different from the table, but must correspond to the column value one by one of the data section. Begindata--indicates that the following data is to be loaded and is valid only if infile is specified as *. 1111, RUSKY1,DBA1,6000, -, -1112, RUSKY2,DBA2,7000, $,Ten1113, Rusky2,dba3,8000, -, -
4. log files, error files, discarded files:
By default, the SQLLDR command produces a log file with the same name as the control file during execution, with a. log extension. If there is an error, an error file with the same name will also be generated with a. bad file name extension. There is also an obsolete file with a file extension of. DSC, which must be specified as an obsolete file, otherwise it will not be generated by default, which records data that is not successfully imported.
If I execute the path of Sqlldr under CMD window: C:\users\administrator>, then the log file and error file generated by default are all under this path.
Sqlloader Test A