Use sqlloader to import data

Source: Internet
Author: User
> Use sqlloader to import data <
 

Environment Description:
Database: oracle8.1.6oem;
System: Windows2000 Server.
**************************************** **************************************** ***********
Use NotePad to create the control file input. CTL. The content is as follows:

Load data
Infile 'test.txt '-- Data File
Append into Table Test
Fields terminated by '|' -- or '09', that is, the field termination and Tab
(-- Field name
Cp_bh char (30 ),
MC char (50 ),
Cp_ljmc char (100 ),
Zyh char (20 ),
DJ
)

**************************************** **************************************** ***********

The content format in test.txt of the example file, for example:

10300108200 | XPB65-113S | pp 34kg | 0030200525 | 3.42000008
10300108200 | XPB65-113S | wash bucket cover light blue Transparent ABS | 0030200877 | 15.52000046

Generally, the data is exported to each other. For example, you can save the data exported from Excel as: separated by tabs, named test ,......, And so on.
**************************************** **************************************** ***********
Use SQL * loader to import data (sqlldr -? View help)

Run the following command in "run:

Sqlldr username/PW control = path/input. ctl data = path/test.txt log = path bad = path

 

Use sqlloader to import inputs in batches:
You can use sqlloader to import data in batches from files.
1. Insert: the data in the import table should be empty.
2. append method: equivalent to append. Data is inserted based on the previous method.
3. truncate: truncate the data in the table before importing.
4. Replace: delete all the data in the table before importing the data.
There is no obvious difference between the truncate and replace methods, but one is truncate and the other is Delete.
In this view, it should be a recovery that can be restored through flash, and a recovery failure.
Sqlldr userid = username/pwd @ servicename control =./CTL
Create Table position (col1 char (5), col2 char (5 ))
Control file ):
-- Specify the file method -------
Load data
Infile 'd:/*. CSV'
Append/insert/replace/truncate
Into Table table_name
(Col1, col2)
----------------------

-- Specify the column width:
Load data
Infile *
Append/insert/replace/truncate
Into Table table_name
(
Col1 position (0:05) Char (5 ),
Col2 position (06:10) Char (5)
)
Begindata
1234567890
Abcdefghij

Trackback: http://tb.blog.csdn.net/TrackBack.aspx? Postid = 826053

 

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.