I want to fetch all the records from the cmdb_ci table with a certain hostname but host_name column is not a part of the cmdb_ci table. So, is their any way we could do this?

mp31
Tera Contributor

I'm trying to get all the record with a specific hostname but as the host_name column is not part of the cmdb_ci table. So is there any way I could get all the record from various table extending cmdb_ci table  through script.

6 REPLIES 6

sangareddy
ServiceNow Employee
ServiceNow Employee

Hi Manish,



You can try with CI name ,most of the times the CI name will be hostname.



Thanks


Trinadh


mp31
Tera Contributor

No This is not the case always. Host name and CI name are different for most of the CIs


find_real_file.png


carlosj
ServiceNow Employee
ServiceNow Employee

If you are on Jakarta you will have a new hierarchy for cmdb_ci tables.   The host_name column will not exist on the base table and is added to a partition table which is comprised of a child table which has the column.   So, in other words, cmdb_ci_server has a host_name column physically and cmdb_ci_software_application will not have a host name as the column is not relevant.   You must identify which ci tables have the host name column via sys_db_object or sys_dictionary and query them independently.


HugoFirst
Kilo Sage

Since the host_name is defined on the cmdb_ci_server table, that would be the "best you can do",     at first glance.


See Schema Map below.     But I suspect that what you really want is to see all the CI's which have a relationship with a given host.


So I recommend that you look at the cmdb_rel_ci table.   It maintains relationships between all type so of CI's.


Here are some links to look over:


CI relationships in the CMDB  





-- SCHEMA MAP FOR CMDB_CI_SERVER:


find_real_file.png