Bulk loading imports large files into Oracle tables at high speed using tools like SQL*Loader and External Tables.
Bulk loading bypasses row-by-row processing, letting Oracle write data in large blocks. Direct-path mode can be 10–20× faster than INSERT, avoids undo overhead, and minimizes logging.
SQL*Loader, External Tables, and Data Pump Import (impdp) all move data quickly. SQL*Loader gives the most control and works from flat files.External Tables expose files as read-only tables, perfect for one-off loads or ETL staging.
Disable unnecessary indexes and foreign keys on Customers
, Orders
, Products
, and OrderItems
. Make sure target columns match the file layout. Create staging tables if you need data cleansing first.
Run sqlldr
from the OS shell, point to a control file, and choose conventional or direct path.The control file maps file fields to table columns and sets load options.
Q: How do I load a CSV into Customers
?
Q: How do I skip the header row?
Q: How do I maintain sequence values?
Write a plain text file ending in .ctl
. List the target table, file location, delimiters, and column mappings.Use FIELDS TERMINATED BY ','
for CSV and OPTIONALLY ENCLOSED BY '"'
for quoted strings.
Use DIRECT=TRUE
in the SQL*Loader command. This lets Oracle write blocks directly to datafiles, ignoring the buffer cache, so it is much faster for millions of rows.
SQL*Loader produces a log file, bad file (rejected rows), and discard file (filtered rows). Check the log for elapsed time, logical records read, and any ORA-errors.Validate counts against the source file.
Load into staging tables, validate, then INSERT /*+ APPEND */
into production. Parallelize loads with PARALLEL=TRUE
. Always collect statistics after loading to keep the optimizer accurate.
Do not forget to set SKIP=1
when files have headers. Avoid loading into tables with active triggers—they fire for every row and slow the job.
.
Yes. List each table in the same control file, separated by INTO TABLE
clauses. SQL*Loader processes them sequentially from the same data file or different files.
SQL*Loader writes rejected records to the .bad
file. Inspect, fix, and re-load them with sqlldr ... data=customers.bad
. The WHEN
clause in the control file can pre-filter rows.
Performance is similar for single-thread loads. SQL*Loader direct path edges ahead at high parallelism, but External Tables integrate cleanly with SQL and need no separate logs.