Import data to Oracle using SQL * Loader

xiaoxiao2021-03-06  43

Use Oracle's SQLLDR tool to import data in the SDSS.CSV file into the database.

SDSS.CSV is placed in E: / content as follows:

2.3757291096910399E-4, -8.9490277843631194,20.302597, 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,

Steps:

1. Create a holiday in the format of the import data in Oracle

Type size decimal Ra Number 18 15 Dec Number 18 15 MAG Number 8 6

2, write a loader.ctl file, the content is as follows

Load Data // Control File Identifies INFILE '/BACKUP/Incoming/sdss.csv' // To Enter Data File Name InTo Table SDSS // Table Operation Fields Terminated By "// Field Tariff Definition (RA , DEC, MAG) // Defines the column corresponding order

Operation class:

A, INSERT, for the default method, the table is required to be empty when the data load starts, add new records C, Replace, delete old records, replace it into newly loaded records D, Truncate, and 3, The following statement is performed in the CMD:

SQLLDR SSS / Oracle Control = Loader.ctl

4, automatically generate two files in the current directory

The default log file name is: loader.log Default bad log file is: SDSS.BAD

Precautions:

1. Must operate on the server native, you cannot use only the Oracle client installed. 2, the content of the CSV file is "," separated, if the data is incorporated when there is no comma in the end, it will be wrong. You can use the text editor such as UltraEdit, replace ^ P, ^ P can add a comma at the end of each line. 3. Data introduction takes a long time.

4. Import different tables need to use different .ctl files

转载请注明原文地址:https://www.9cbs.com/read-51723.html

New Post(0)