Export Relationship Mappings for database CIs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
We are looking to validate CI relationship mappings for our database CIs. Is there a recommended way to export all database CIs along with their associated dependency views? We use ServiceNow Discovery.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thursday
Hi @VickiL ,
Yes, you can export database CIs and their relationship mappings using a combination of CMDB tables and Discovery data. The recommended approach involves querying the cmdb_ci_database and cmdb_rel_ci tables.
1. Target the Right Tables
- Database CIs are stored in the cmdb_ci_database table.
- Relationships are stored in the cmdb_rel_ci table, which links CIs via parent and child fields.
2. Build a Scripted Export (Suggested for Large Sets)
Use a background script or scheduled job to extract relevant data:
var dbCI = new GlideRecord('cmdb_ci_database');
dbCI.query();
while (dbCI.next()) {
var rel = new GlideRecord('cmdb_rel_ci');
rel.addQuery('parent', dbCI.sys_id);
rel.query();
while (rel.next()) {
gs.print('Database CI: ' + dbCI.name +
', Related CI: ' + rel.child.name +
', Relationship Type: ' + rel.type.name);
}
}You can modify this to write to a file or push to an export table.
3. Use Dependency Views (Optional Visualization)
- Dependency Views are visual representations built from relationship data.
- While you can’t export the visual map directly, you can replicate its structure by exporting the relationships from cmdb_rel_ci.
4. Export via List View (Quick Option)
- Go to cmdb_ci_database list view.
- Configure the list to show fields like name, sys_id, and use a related list for cmdb_rel_ci.
- Use the Export > CSV/XML/Excel option.
5. Consider CI Relationship Editor (Advanced)
- Use the CI Relationship Editor to manually inspect and validate mappings.
- For bulk validation, consider building a report or dashboard using Performance Analytics or CMDB Query Builder.
Here is a best practice you can follow:
- Filter by Discovery Source to ensure you're only validating discovered CIs.
- Include relationship type (e.g., “Runs on”, “Depends on”) for clarity.
- Audit for orphaned or circular relationships using CMDB Health Dashboard.
If it is helpful, please hit the thumbs button please mark the answer as correct based on the impact!!
Kind Regards,
Shaik Mohammed Mustaq
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @VickiL ,
There are multiple ways to do that.
First things first, you need to narrow down what do you mean by Database CIs. Is it the Database Instance, is it the Database Catalog, is it the Cloud Databases? Maybe all of them?
That defined we can move on.
Second would be to define what you want to validate; you might have requirements are cross but most likely you also have requirements that are specific to the database type itself.
Once you have that, I would suggest to investigate ways to validate it using ServiceNow features; you most likely don't need to export them to validate it.
Features you can use:
- CI Class Manager
- Review/Define your Suggested Relationships
- Review/Define your Health Rules
- What a "Health" database" CI looks like in terms of the three Cs
With the Health Rules configured
- What a "Health" database" CI looks like in terms of the three Cs
- Relationship Health dashboard
You can see there relationships that are not "compliant" with your model - CMDB Health Dashboard
Here you will see the Health indicators of your "databases".
So you have all the features inside ServiceNow to define what good/health looks like, to identify and to measure where you are, what is right and what is wrong.
Next step is remediate them. Again multiple ways, you can configure tasks to be created from the CMDB Health Dashboard, maybe you want to configure a Data Policy and you might even want to automate the remediation; the sky is the limit.
If you really need to export, you could go with @Me Being Mustaq suggestion or you could also take a look at the CMDB Query; you could do that and do one time export or you could even create the query, schedule it's execution, create a report and distribute it automatically on whatever frequency you want.
I would try to things inside ServiceNow first. It's probably takes more time at first but through time it usually pays off to learn how to use ServiceNow features.
O Abreu
