Use of the Oracle Database SQLLDR command

Source: Internet
Author: User
Tags log log import database

There should be a lot of ways to import data into Oracle, and there are different ways to import different requirements, and the recent use of Oracle's SQLLDR command to import database data feels like a pretty good technical point. Using the SQLLDR command to import a text file into Oracle takes roughly two steps:

First step: Write the CTL control file

Load Data--loading (in the second step, the source location of the data file is specified)

CHARACTERSET ' UFT8 '--Import Character set format
Append-This attribute means that the original data in the database is appended to its own data, without changing the original data, interested can also learn about other properties such as replace
into table Int_demo_student_b--Tables for inserting databases
Fields terminated by X ' 1 B '--delimiter for splitting the corresponding attribute data in the data file I used the ESC key to split, and the X ' 09 ' equals the comma split
TRAILING nullcols--Empty column assignment, if not add this attribute, when the data file has a null value, will skip the null value, so the import data is misplaced, so add this property can avoid null dislocation
(
stu_id,--Fields, order of fields and database in the same order
Stu_name,
Stu_class,
Stu_age,
Stu_sex,
Stu_subject,
Comment Char (260),---intercept operation, when doing import, the CTL import belongs to the file stream import, when the field character length exceeds 255 bits will import failure, if you need to add this attribute to constrain the import failed
IMPORT_FLAG constant "0",--default assignment, if the original data file does not have a field, and you need to add a field in your database table, you need to added a default value constant
ERR_MSG constant ""
)

Step two: Use the cmd Command window to enter commands SQLLDR command run and press ENTER at the end

SQLLDR userid = username/password @ database name data= data file Address control = CTL Control file Address bad = d:/Bad.bad error logs log =d:/log.log log Recording

You can also enter rows Deirect silent errors and other conditions in the command to limit the number of rows imported, and you can be interested in knowing

At present, the address data are fixed, in the actual application will be defined by defining variables to use, so that can be reused.

Use of the Oracle Database SQLLDR command

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.