Load Data Warehouse job failed with error on primary key

Document ID : KB000108991
Last Modified Date : 10/08/2018
Show Technical Document Details
Issue:
Load DWH Job fails with the following error:
[CA Clarity][Oracle JDBC Driver][Oracle]ORA-02437: cannot validate (PPM_DWH.DWH_INV_TEAM_PK) - primary key violated
ORA-06512: at line 7
Cause:
Caused by a duplicate team record on a project.
Resolution:
Unfortunately the duplicate record cannot be deleted via the UI, and must be done via the database.  Additionally, we must ensure that the record that is being left in place (the one NOT being deleted) must point to the proper team_id.

For On-Premise Environments:

Run the following query against the PPM database:

select odf_pk, count(odf_pk) from dwh_team_v 
group by odf_pk 
having count(odf_pk) > 1 


This will show you the ones that have duplicates.

Next, take the "odf_pk" values from the results and put them into this query inside the parentheses, and run this against the DWH database:

select * from dwh_team_v where odf_pk in (PUT_LIST_OF_ODF_PK_VALUES_HERE ) 

This will show you the specific projects that have duplicate teams.

You can then delete the duplicate records from both the prassignment and odf_ca_assignment tables.
IMPORTANT:  Ensure the records you are leaving are the ones pointed to the proper value!! As always, we recommend testing this in a test enviornment before attempting to do this in product.  Additionally, ALWAYS backup the database prior to deleting any records.


For SaaS Environments:
If you are a customer on a SaaS environment, please open a case with CA Support so the queries can be run for you.