Use SQL * loader to import data to Oracle

Source: Internet
Author: User

Use the sqlldr tool of Oracle to import data from the SDSS. CSV file to the database.

The content of SDSS. CSV placed on E: \ is as follows:

2.3757292136910399e-4,-8.9490277843631194, 20.302597,
December 0.00023851549291556,-0.88450365314434698, 20.098101,
2.5168890447969299e-4, 7.7169029946908094e-2, 18.762859,
2.9486118387225802e-4,-9.8447540892170409, 19.943598,
2.94865362739442e-4,-9.8447540642891909, 19.944597,

Procedure:

1. Create an empty table in Oracle according to the imported data format

Decimal type
RA number 23 20
Dec number 23 20
Mag number 8 6

2. Compile a loader. CTL file with the following content:

Load data
Infile 'e: \ sdss.csv'
Into Table sdss_stars
Fields terminated ","
(RA, Dec, MAG)

3. Execute the following statement in cmd:

Sqlldr Scott/tiger control = loader. CTL

4. Two files are automatically generated in the current directory.

Default Log File Name: loader. Log
The default bad record file is SDSS. Bad.

Note:

1. operations must be performed on the local server and cannot be performed on machines that only install the Oracle client.
2. The contents of the CSV file are separated by commas (,). If the data is not imported with commas (,) At the end, an error occurs.
You can use the ultraedit and other text editors to replace ^ P with ^ P. Then, you can add a comma at the end of each line.
3. Data Import takes a long time.

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.