How to merge cmdb_ci_db_instance CIs, their relationships and associated tasks?

gklarmann
Kilo Contributor

We have a CMDB where we have integrated third party discovery tools that has resulted in duplicate cmdb_ci_db_instance CIs. They have relationships back to the Server CI they run on and many have different kinds of tasks (Change and Incident) to both CIs.

We have a solid foreign key to coalesce on to alleviate this issue going forward. But need to cleanup (merge all into one CI) what's there now. Working on a script to merge these CIs, delete relationships to old CIs and move tasks from old to new CIs.

Seen several posts with some high level recommendations but no details.

Has anyone done this before and have some code to share? The merge and relationships I have figured out. Looking at the tasks now. Any help is greatly appreciated.

Also, if there is something I'm overlooking, input would be appreciated as well.

2 REPLIES 2

bernyalvarado
Mega Sage

Hi George,



You could migrate the tasks by doing a script (server side) with a GlideRecord over the task table and just update the cmdb_ci with the right CI.



In regards the relationships between the CIs, that's managed within the cmdb_rel_ci table.



Thanks,


Berny


bernyalvarado
Mega Sage

A couple of additional advices...



a) always back up your data before starting doing any updates on it.


b) If possible, always apply, test and validate your update operations in a sub-production instance with production alike data (hopefully one with a recent clone from Production).



Thanks,


Berny