SQL Loader in ORACLE

Download Oracle Instant Client tools :instantclient-tools-windows.x64-21.12.0.0.0dbru 

SQL*Loader Features

SQL*Loader loads data from external files into tables of an Oracle database.

It has a powerful data parsing engine that puts little limitation on the format of the data in the data file. You can use SQL*Loader to do the following:

  • Load data across a network if your data files are on a different system than the database.

  • Load data from multiple data files during the same load session.

  • Load data into multiple tables during the same load session.

  • Specify the character set of the data.

  • Selectively load data (you can load records based on the records' values).

  • Manipulate the data before loading it, using SQL functions.

  • Generate unique sequential key values in specified columns.

  • Use the operating system's file system to access the data files.

  • Load data from disk, tape, or named pipe.

  • Generate sophisticated error reports, which greatly aid troubleshooting.

  • Load arbitrarily complex object-relational data.

  • Use secondary data files for loading LOBs and collections.

You can use SQL*Loader in two ways: with or without a control file. A control file controls the behavior of SQL*Loader and one or more data files used in the load. Using a control file gives you more control over the load operation, which might be desirable for more complicated load situations.

The output of SQL*Loader is an Oracle database (where the data is loaded), a log file, a bad file if there are rejected records, and potentially, a discard file.


Steps in  Unix:

Write the loader command to a file as follows :

echo "load data infile '/data/cifs/fs/freightcron_stg/gsa/Temp/files/<FileName>.txt'
  into table <tablename>
  fields terminated by '~' TRAILING NULLCOLS
  (NAME, ADDRESS, CITY, STATE)" >> /data/cifs/fs/freightcron_stg/gsa/Temp/files/controlfile_oracle_new.ctl

Execute the SQL Loader : 

 /usr/lib/oracle/21/client64/bin/sqlldr userid=username/password@hostname:1526/sid control='/Temp/files/controlfile_oracle_new.ctl'  direct=true


Comments

Popular posts from this blog

Why to do a POC (Proof Of Concept)