SQLMentor // learn sql*loader

The sqlldr Command Line

The sqlldr executable accepts key=value parameters, in any order, on the command line or in a parameter file.

Common flags

sqlldr userid=hr/hr@//localhost:1521/orclpdb  \
       control=employees.ctl                  \
       data=employees.dat                     \
       log=employees.log                      \
       bad=employees.bad                      \
       discard=employees.dis                  \
       errors=50                              \
       skip=1                                 \
       load=10000                             \
       rows=5000                              \
       bindsize=2097152                       \
       readsize=2097152                       \
       direct=true                            \
       parallel=true                          \
       silent=header,feedback

Parameter reference

Flag Default Meaning
userid (prompted) Connection: user/pass@tns
control required Path to control file
data from INFILE in control file Override the data file
log <control>.log Log destination
bad <control>.bad Bad-file destination
discard (none) Discard-file destination (creates one)
discardmax unlimited Stop after N discarded rows
errors 50 Max rejected rows before abort
skip 0 Skip N records at start (re-start support)
load unlimited Stop after N successful records
rows conventional: 64 / direct: all Commit interval (conventional) or save interval (direct)
bindsize 256 KB Bind array size, conventional path
readsize 1 MB Read buffer; should equal bindsize
columnarrayrows 5000 Direct-path stream column array rows
streamsize 256 KB Direct-path stream buffer
direct false Use direct path
parallel false Permit concurrent direct path loaders on same table
silent (none) Suppress messages: header, feedback, errors, discards, partitions, all
external_table NOT_USED GENERATE_ONLY / EXECUTE to use external table backend
resumable false Enable resumable space allocation
multithreading enabled on direct Use multiple threads for direct-path conversion

Express mode (12c+)

For ad-hoc loads against a CSV with a header row matching the table's column names, skip the control file entirely:

sqlldr userid=hr/hr table=employees data=employees.csv

sqlldr synthesises a control file (with FIELDS CSV WITH EMBEDDED) and runs the load. Great for quick imports; for anything reusable, write a real control file.

Parameter file (parfile=)

# nightly.par
userid=hr/hr@//db:1521/orclpdb
control=orders.ctl
log=/var/log/orders/$(date +%F).log
bad=/var/log/orders/orders.bad
errors=0
direct=true
parallel=true
sqlldr parfile=nightly.par data=orders_2024-12-01.csv

CLI args override parfile values. So you can keep the static config in the parfile and vary only the input file.

Best practices

  • Never hard-code passwords on the command line; use a wallet, an env var, or userid=hr/hr and rely on ORACLE_PWFILE
  • Always set errors= explicitly — the silent default of 50 may hide bigger issues
  • Pair bindsize with readsize (same value); a small readsize will throttle even huge bindsize
  • Use silent=feedback in cron jobs to keep logs quiet but keep error visibility
  • skip= is your friend for resuming an aborted load — don't re-feed already-loaded rows