Wednesday, 23 March 2011

SQL Loader

SQL*Loader (sqlldr ) is the utility to use for high performance data loads. The data can be loaded from any text file and inserted into the database.

During processing, SQL*Loader writes messages to the log file, bad rows to the bad file, and discarded rows to the discard file.

The Control File

The SQL*Loader control file contains information that describes how the data will be loaded. It contains the table name, column data types, field delimiters, etc. It simply provides the guts for all SQL*Loader processing.

SQL*Loader Options

SQL*Loader provides the following options, which can be specified either on the command line or within a parameter file:

  1.  bad – A file that is created when at least one record from the input file is rejected. The rejected data records are placed in this file. A record could be rejected for many reasons, including a non-unique key or a required column being null.
  2.  bindsize – [256000] The size of the bind array in bytes.
  3.  columnarrayrows – [5000] Specifies the number of rows to allocate for direct path column arrays.
  4.  control – The name of the control file. This file specifies the format of the data to be loaded.
  5. data – The name of the file that contains the data to load.
  6.  direct – [FALSE] Specifies whether or not to use a direct path load or conventional.
  7. discard – The name of the file that contains the discarded rows. Discarded rows are those that fail the WHEN clause condition when selectively loading records.
  8.   discardmax – [ALL] The maximum number of discards to allow.
  9. errors – [50] The number of errors to allow on the load.
  10. external_table [NOT_USED] Determines whether or not any data will be loaded using external tables. The other valid options include GENERATE_ONLY and EXECUTE.
  11. file – Used only with parallel loads, this parameter specifies the file to allocate extents from.
  12. load – [ALL] The number of logical records to load.
  13.  log – The name of the file used by SQL*Loader to log results.
  14.  multithreading – The default is TRUE on multiple CPU systems and FALSE on single CPU systems.
  15.  parfile – [Y] The name of the file that contains the parameter options for SQL*Loader.
  16.  parallel – [FALSE] Specifies a filename that contains index creation statements.
  17.  readsize – The size of the buffer used by SQL*Loader when reading data from the input file. This value should match that of bindsize.
  18.  resumable – [N] Enables and disables resumable space allocation. When “Y”, the parameters resumable_name and resumable_timeout are utilized.
  19.  resumable_name – User defined string that helps identify a resumable statement that has been suspended. This parameter is ignored unless resumable = Y.
  20.  resumable_timeout – [7200 seconds] The time period in which an error must be fixed. This parameter is ignored unless resumable = Y.
  21.  rows – [64] The number of rows to load before a commit is issued (conventional path only). For direct path loads, rows are the number of rows to read from the data file before saving the data in the datafiles.
  22.  silent – Suppress errors during data load. A value of ALL will suppress all load messages. Other options include DISCARDS, ERRORS, FEEDBACK, HEADER, and PARTITIONS.
  23.  skip – [0] Allows the skipping of the specified number of logical records.
  24.  skip_unusable_indexes – [FALSE] Determines whether SQL*Loader skips the building of indexes that are in an unusable state.
  25.  skip_index_maintenance – [FALSE] Stops index maintenance for direct path loads only.
  26.  streamsize – [256000] Specifies the size of direct path streams in bytes.
  27.  userid – The Oracle username and password.


  1. To drive the concept of the SQL loader home.., let us assume that we have text file which is the usual emp table.
  2. Now open the cmd prompt and type sqlldr.
  3. later the things should look some thing like this.

sqlldr# userid=username/pwd@ora

load data

in file ‘C:\emp.txt’

into table emp_oracle

fields terminated by “,”optionally enclosed by’ ” ’



  1. Hi Naveen,

    Appreciate your efforts on queries.

  2. Hi Naveen,

    I need Advanced pl/sql concepts also. Unix scripts blog is not visible properly.

  3. Could you please add some more sql concepts also.