Using CA Gen 8.5 CSE with IET's GuardIEn. During a Model Copy of a DEV model it fails as follows:
GuardIEn
Copy Model, Task T50617
Start Time: 2020-09-07 08:41:42
Assoc store: association already exists
Src id = 802772782, atc = 873
Dest id = 803088105
Return Code: 1
Release : 8.5
Component : CA Gen Client Server Encyclopedia
The error message implies a 2nd (duplicate) association with type 873 (a CHNGED association) is trying to be created from Src id = 802772782 to Dest id = 803088105.
The Src object would be of object type SESSION (50).
Although the copy fails the resulting unusable/orphan model with DMDL table model_name = '&<model_id>' and model_status ='U' is still in the CSE.
The GuardIEn object reports show 802772782 is an object type SESSION (50) and 803088105 is an object type BUSPROC (59). NOTE: If GuardIEn is not being used, the CSE Support Client Utility Walkency will also show the same information for those object ids.
Running CSE Support Client Utility Walkency on the original model shows that the BUSPROC with the same NAME property as object id 803088105 has only 1 CHNGDBY association to it from a SESSION object id 1136683596, so that does not match with the implication of the error message that there are 2 associations. The BUSPROC also has a DIRCHGBY association to it from the same SESSION object id. An Encyclopedia Validate report was run on the model and that same SESSION object id was reported:
===
Session of model maintenance Date: 20200720 Time: 134209000
Object id = 1136683596, type = SESSION(50)
Association TO object does not exist:
Association type code = DIRCHGD(65)
TO object id = 0, type = (0)
******************************
Association TO object does not exist:
Association type code = CHNGED(873)
TO object id = 0, type = (0)
===
Running SQL against the DASC table confirmed 2 rows existed with assoc_from_obj_id=1136683596 where the object did not exist in dobj and also assoc_to_obj_id=0:
===
select * from dasc where assoc_from_obj_id=1136683596 and assoc_to_obj_id not in (select obj_id from dobj);
select * from dasc where assoc_from_obj_id=1136683596 and assoc_to_obj_id=0;
===
It is that corruption that is causing the model copy to fail (support created the same scenario in-house with a deliberately corrupted model)
To resolve the corruption problem those 2 DASC table rows need to be deleted.
Please note that running delete SQL only recommended if there is a recent model backup or complete CSE database backup.
In this case, copying the model as a backup is not feasible because that operation is failing, so having a recent CSE database backup is recommended.
To resolve the problem delete and commit the 2 rows from the DASC table using SQL:
===
delete from dasc where assoc_from_obj_id=1136683596 and assoc_to_obj_id=0;
commit;
===
Then re-run the Encyclopedia Validate report and the errors for the SESSION object id 1136683596 have gone.
The model copy is then successful.
NOTE: For this type of model corruption issue, unless you are a very experienced Gen model manager it is normally best to create a support case so that Gen Support can advise on the appropriate SQL to run to resolve the problem.