My Oracle Support Banner

Using SQL*Loader WIth Parameter NO_INDEX_ERRORS=TRUE Causes An Inconsistent Table State (Doc ID 1396694.1)

Last updated on OCTOBER 10, 2019

Applies to:

Oracle Database - Enterprise Edition - Version 11.2.0.1 and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Cloud Exadata Service - Version N/A and later
Information in this document applies to any platform.

NOTE: The document content below, the user information and data used represents fictitious data from the Oracle sample schema(s) or Public Documentation delivered with an Oracle database product.
Any similarity to actual persons, living or dead, is purely coincidental and not intended in any manner.

Symptoms

You started SQL*Loader in direct path mode with parameter NO_INDEX_ERRORS=TRUE and observed an inconsistent table state after the load. The next test case demonstrates this:

-- create the environment
connect test/test

create table t (x number, constraint t_pk primary key(x));

-- SQL*Loader control file ldr.ctl
options (direct=true, errors=0, no_index_errors=true)
load data
infile *
truncate
into table t
fields terminated by ','
trailing nullcols
(
   x
)
begindata
1
x

-- start SQL*Loader
#> sqlldr test/test control=ldr.ctl


This terminates with:

Load completed - logical record count 2.


The log file contains:

Record 2: Rejected - Error on table T, column X.
ORA-01722: invalid number

Specify SKIP=1 when continuing the load.
The following index(es) on table T were processed:
index TEST.T_PK loaded successfully with 1 keys

MAXIMUM ERROR COUNT EXCEEDED - Above statistics reflect partial run.

Table T:
1 Row successfully loaded.
1 Row not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.


Then:

SQL> select count (*) from t;

COUNT(*)
----------
         0

SQL> insert into t values (1);
insert into t values (1)
*
ERROR at line 1:
ORA-00001: unique constraint (TEST.T_PK) violated


Note: This occurs *only* when ERRORS=<n> is specified. It seems, when the count of allowed errors is exceeded, the index remains loaded but not the table. This explains count 0 in table but ORA-1 from index when an already existing value is again inserted.

If you take out ERRORS=0 from control file above, then the behavior is the expected one:

- the count from table shows 1 row
- the index is loaded with 1 key

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution
References

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.