SAP Note 11369 - ORA-1452 during import after export from other system.

Symptom

ORA-1452 cannot CREATE UNIQUE INDEX; duplicate keys found
when you import a dataset that was exported from a source system into a target system.

Reason and Prerequisites

A table in the source system contains duplicate keys, although a UNIQUE index existed there. This may result from rollback problems with ORACLE 7.0.13 in connection with cluster tables containing long raw fields.

Solution
Determine the keys:
DESCRIBE sapr3.;
???Fields with entry NOT NULL

Determine the duplicate records (summary diplay of the records
with multiple key values):

select alldata.rowid, alldata.*
from
alldata,
(SELECT , ...,
FROM

GROUP BY , ...,
HAVING COUNT(*) > 1) keydata
where alldata.=keydata.
and ...
and alldata.=keydata.;

For example:
Table with duplicate keys is sapr3.dk with 2 key columns c1 and c2

select alldata.rowid, alldata.*
from SAPR3.dk alldata,
(SELECT c1, c2 FROM SAPR3.dk GROUP BY c1, c2
HAVING COUNT(*) > 1) keydata
where alldata.c1=keydata.c1
and alldata.c2=keydata.c2;

When large tables are involved, we recommend that you create the index that could not be created as NONUNIQUE before you start the query. This will result in a significantly shorter runtime for the query. Check the records output by the query to make sure they are absolutely identical (non-key fields). If in doubt, contact the developer to find out how to correct the inconsistency. If the records are absolutely identical, the duplicate record can be deleted. The best way to do this is by using the ROWID selected above:

DELETE
FROM SAPR3.
WHERE keyfeld_1 = key_value_1
AND keyfeld_2 = key_value_2
...
AND keyfeld_n = key_value_n
AND ROWID <> ;

Once all the duplicate records have been deleted, the index which could not be created must be created as a UNIQUE INDEX.

Keyword: ORA-1452

Comments

Popular posts from this blog

SAP Note 11489 - What to do when there are print problems in QM.

SAP Note 11507 - Fields returned wrong in elec. bank statement.

SAP Note 11477 - Check deposit: fields are not printed.