Oracle_ using CTL files for bulk Import

Source: Internet
Author: User

The use of Oracle control files to enable storage of large quantities of data is much more efficient than SQL script files.

The steps for using the CTL control file are as follows:

1. Making a CTL file Test.ctl

Load data

infile ' d:\test.txt ' --data file, data source file

Append into table table_name--target table for data file import

Fields terminated by "@[email protected]"--field separators, we recommend special characters as field separators

Optionally enclosed by ' "'--delimiter

Trailing Nullcols--Allow skipping columns

( col1, col2, col3, Col4) fields in---table

----above italic part of the text, please replace according to the actual situation

2. Making a data source file

There is only data in the file and data columns are separated by "@[email protected" (you can export the data with a command or tool and then edit it via UE)

3. Execute the CTL file

Command line cmd execution, CD to Oracle control file directory,

Execute command: Sqlldr oracle/[email protected] control =test.ctl, errors=50000, load=450000

4. Implementation results

The result of the execution will be the log file (Input.log) corresponding to the name of the control file generated under Oracle's control file, which details the results of the operation.

5. When loading large amounts of data (approximately 10GB), it is best to suppress the generation of logs:

Sql>alter TABLE resultxt nologging;

This does not produce redo LOG, which can improve efficiency

---------------------------Example---------------------------------------------

--November 26, 2014 Wednesday 10:25 12 SEC--z_org.ctl
--Loading data into table z_org
Load data
InFile ' Z_org.txt '--Data file
Badfile ' Z_org.bad '
Replace into table z_org-Replaces table z_org content
Fields terminated by ' @[email protected]'--field delimiter
TRAILING nullcols---allow skipping columns
(
Gather_date Date "Yyyy-mm-dd",
Xaccount,
Name,
Sms_frees,
Freesign,
Sms_lowamt,
SMS_LOWAMX,
MP_L_LMT,
Mp_auths,
Mpausign,
MP_REM_PPL,
Mpremsig,
Mp_bal,
Mpbalsig,
Cal_limit,
Cal_auths,
Cal_auths_flag,
Cal_bal,
Cal_bal_flag,
CAL_REMPPL,
Cal_remppl_flag,
Sms_freeyn,
BAL_MPPL,
BAL_MPPLX,
BAL_L_MPPL,
Daily_rep,
Product,
)

Oracle_ using CTL files for bulk Import

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.