SYMPTOM:
Suppose there are three project sources: test, production and intermediate (used at transitional stage). First duplicate a project from test environment to intermediate project source, and then duplicate the project to production.
After duplicating the project from intermediate project source to production, below errors can be found from both the Duplicate.log and DuplicateCorruptedObjects.log.
Object with ID 'xxxxxxxxxxxx' and type 29 (DB Instance) is not found in metadata. It may have been deleted.
Object variable or With block variable not set
In the intermediate project source, only change the database connection to point to a different SAP environment. The database instance is found existing in both Test and Production, but not in the intermediate project source.
CAUSE:
Missing reference to extra SAP BW Database Instance in the intermediate project source.
The database instance that is missing in the intermediate project source, but exists in both the Test and Production environment, is because there are no projects that directly using his database instance.
When querying the Test metadata the database instance is there, but it was not directly used by the source project which is being duplicated. Querying the Production database this database instance also exists. No issue happens when migrating from Test to the intermediate project source because the Source project doesn't use that database instance directly. However, when moving from the intermediate project source to Production it found an inconsistency with the database instances (existed in Prod but not in source), with the same ID that the one used in Test. The duplication wizard was trying to do a match, and it failed.
This issue happens when using the database instances at first and after some time dissociating them from the project, but in some way the database instance remains.
ACTION:
Migrate the database instance from Test environment to intermediate project source, and duplicates the project from intermediate project source to Production again by including the extra database instance object which even doesn't appear to have a dependency on the project resolves the issue.
This issue can be avoided by taking care of which objects are used by which projects and objects. Also pay attention when using Free Form SQL reports and Data Marts, because this kind of objects use Database Instance by themselves, so this may be another point need to check for some missing references. The next thing to do is to take a deeper look of these relationships because there are some objects there that still have some reference to this database instance object.
For other points to take into consideration when duplicating projects which have SAP data, refer to below tech note:
KB30584: Best practices for project duplication for projects that are connected to different SAP BI environments. KB35685