Truncate the PR_DATA_RESTORE table and try with the data upgrade.
PR_DATA_RESTORE table is used for reversing an update and this feature is introduced in Pega 7.1.7 onwards. This table captures all the data instances which got imported during the Data Upgrade process.
When we perform the reversibility then it gets all the records from this table and removes from the Data schema. Reversibility is only supported if you are already on Pega7.1.x and doing an update to Pega 7.1.y.
As you are performing the data upgrade second time it is trying to capture all the data instances one more time in the PR_DATA_RESTORE table and failing with unique constraint violation error.
Not sure if my explanation was clear enough. Just to clarify once again, we are not upgrading data second time, it's a diffetent environment where we are upgrading data.
Step 1. In one environment (development) we have upgraded successfully from single schema PRPC6.3 SP1 to split schema PRPC 7.1.8.
Step 2. Now in another environment (TEST), we have created one schema (PRPCRULES) and imported the upgraded 7.1.8 Rules schema (export taken from upgraded 7.1.8 development environment as mentioned in step1) to TEST environment. After that we are running --dataOnly upgrade in the PRPC 6.3 original schema of TEST environment which has both data and rules to upgrade the data.
So kindly confirm, in this scenario we have to do the same steps that you suggested (truncate of PR_DATA_RESTORE)?
Yes you right. when you have performed DataOnlyUpgrade on first environemnt it is populated the data instances inthe PR_DATA_RESTORE table and when you are performing the Data Only Upgrade on second enviornment pointing to same RULES SCHEMA which got upgraded in first environemnt it is trying to insert same data instnaces and failing with unique key error.
From 7.1.7, PRPC updates(not upgrade) are reversible. Both update and upgrade collects metadata about new/updated rules to support reversibility. PRPC uses PR_DATA_PRODUCTS and PR_DATA_RESTORE tables to store this metadata.
Unique constraint error appears as same data is being inserted into PR_DATA_PRODUCTS during second upgrade, so it needs to be truncated.