Friday 6 November 2015

BI Apps ODI Load Plan Execution Error due to CREATE UNIQUE INDEX; duplicate keys found

Sometimes there are duplicate data rows in the source tables, due to this while running a ODI Load Plan (LP) in BI Applications 11.1.1.7.1 the ODI sessions may error out while creating the unique indexes.

Error:
ODI-1228: Task TABLE_MAINT_PROC (Procedure) fails on the target ORACLE connection BIAPPS_DW.
Caused By: java.sql.SQLException: ORA-20000: Error creating Index/Constraint : W_FLEX_SQL_G_U1 => ORA-01452: cannot CREATE UNIQUE INDEX; duplicate keys found

Solution:
1. Finding the duplicate rows:
select domain_code, domain_member_code, column_expression, datasource_num_id, count(*)
from w_flex_sql_g
group by  domain_code, domain_member_code, column_expression, datasource_num_id
having count(*)>1;

2. Execute the delete command on the duplicate rows
ex: DELETE FROM table_name A
    WHERE a.rowid >
    ANY (SELECT B.rowid FROM table_name B WHERE
A.col1 = B.col1
      AND
        A.col2 = B.col2);

No comments:

Post a Comment