CMDB Relationship Cleanup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday
Hi All,
In CMDB relationship table (cmdb_rel_ci),I have total of 4 Million relationships for which parent is non-operational /retired or child is non-operation/retired .SO we want to clean this data with removing these stale/orphan relationships. Also in for future want to make a automatic process if any parent or child is updated as non-operation /retired ,then respective relationship should be removed .What should be the best practice to deal with this data and Do we have functionality from service now to deal with this clean up process.Please suggest .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Friday
Hi @_bhishek ,
One-Time Cleanup of Existing Stale Relationships
You can safely remove relationships where:
Either parent or child CI is in Retired or Non-Operational state
The CI no longer exists (deleted or missing)
Fix Script Option
Use a script that identifies relationships where either CI is retired
Optionally previews the records before deletion
Deletes in chunks to avoid performance issues
Automated Cleanup for Future Retirements
Use Business Rules or Flows
Create a Business Rule or Flow Designer logic that:
Triggers when a CI’s install_status changes to Retired or Non-Operational
Queries cmdb_rel_ci for relationships involving that CI
Deletes those relationships
This ensures real-time cleanup and prevents stale data from accumulating.
Use CMDB Health Dashboards
Leverage CMDB Relationship Health to monitor stale or broken relationships
Use CMDB Data Manager to define lifecycle policies for CIs and automate cleanup tasks [servicenow.com]
Avoid Manual Deletion of CIs
Instead of deleting CIs, mark them as Retired
Use cleanup scripts to remove only the relationships, preserving historical CI data for audit or reporting
You Can Use
CMDB Data Manager: Automate lifecycle transitions and cleanup
GlideTableCleaner: For bulk cleanup with minimal performance impact [servicenow.com]
Scheduled Jobs: Run periodic cleanup scripts
Relationship Health Dashboard: Identify and track stale relationships
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @_bhishek Data Manager is the best out of the box approach for your scenario. Please check out this reply from @ Tony Branton in the below community Post.
You can use CMDB Data Manager to create a policy to retire CIs. Data Manager will use the Retirement Definition corresponding to the CIs' classes to set the appropriate field to a retired state. Data Manager executes retirement policies on a daily basis, so whenever CIs meet the filter criteria in a policy, the CI will be retired - it's automated.
Retired CIs can then be processed by Archive or Delete policies. If for example you wanted to delay archiving retired CIs for 7 days, you can include that as part of the filter condition. As with Retire policies, Data Manager executes Archive (and Delete) policies on a daily basis and processes retired CIs as they meet the policy's filter criteria. Once setup, the archive/delete process is automated and will process retired CIs.
You can learn more about CMDB Data Manager here.
Regards,
Srinija