Troubleshoot > Troubleshooting Administration > Troubleshooting - Disable History for Specific Object CITs

Troubleshooting - Disable History for Specific Object CITs

In case of investigation, if history was disabled for specific CITs, the logs can provide useful information if the operation finished successfully or why it failed. The logs to check are history logs (mainly history.classmodel.changes.log), error.log and cmdb.dal.log.

For example, if you successfully disabled the history for the installed_software CIT, you should see the following log messages:

------------------ Starting alignment for class installed_software ------------------
	Align will be done for all descendant classes of class [installed_software]
	Class [installed_software] should not store history events anymore, going to remove history tables
	About to remove partition registry for class [installed_software].
	Done removing partition registry for class [installed_software].
	About to remove history table [HDML_170910INSTALL_182931014].
	Done removing history table [HDML_170910INSTALL_182931014].
	About to remove history table [HDMRL_INSTALLED_SOFTWARE_1].
	Done removing history table [HDMRL_INSTALLED_SOFTWARE_1].
	About to remove history table [HDM_170910INSTALL_182931014].
	Done removing history table [HDM_170910INSTALL_182931014].
	About to remove history table [HDMR_INSTALLED_SOFTWARE_1].
	Done removing history table [HDMR_INSTALLED_SOFTWARE_1].
	About to remove class [installed_software] from HDM_ROOT table
	Done removing class [installed_software] from HDM_ROOT table
	About to remove related history links for class [installed_software].
	Retrieved 2,671,197 objects from memory took 452 ms
	Retrieved 3,382,173 related links from memory took 36,850 ms 
	About to delete from root link table
	deleted 565,119 rows
	Entries from root link table deleted successfully
	About to delete from links history tables
	deleted 419,028 rows
	deleted 146,091 rows
	Entries from links history tables deleted successfully
	Done removing related history links for class [installed_software].
------------------ Finished alignment for class installed_software ------------------

To double check that the CITs have been deleted from history tables, you can use the following SQL statements. The count should match with the ones in the logs or should show 0 when running against HDM_ROOT_1 and HDM_Root_Link_1 tables.

  • Check that CIs were deleted from HDM_ROOT_1 table

    select count(*) from HDM_ROOT_1 where OBJECT_CLASS='installed_software'
  • Check the links that were deleted

    Taking installed_software as an example (the related links history tables may vary (usage, composition)).

    Check the number of related links to instances of the CIT that was disabled history

    select count(*) from link_1 l where l.end2_id in (select cmdb_id from CDM_INSTALLED_SOFTWARE_1)
    select count(*) from link_1 l where l.end1_id in (select cmdb_id from CDM_INSTALLED_SOFTWARE_1)
  • Check the number of related links that will be removed from HDM_Root_Link_1 table

    SELECT count(*) from HDM_root_link_1 where CMDB_ID IN (select l.CMDB_ID from link_1 l , cdm_root_1 r where l.END1_ID=r.CMDB_ID and r.A_ROOT_CLASS='installed_software')
    SELECT count(*) from HDM_root_link_1 where CMDB_ID IN (select l.CMDB_ID from link_1 l , cdm_root_1 r where l.END2_ID=r.CMDB_ID and r.A_ROOT_CLASS='installed_software')
    
  • Check the number of related link that will be removed from links history tables (the links history tables may vary (usage, composition))

    SELECT count(*) from HDM_170910CONTAINMENT_1 where CMDB_ID IN (  select l.CMDB_ID from link_1 l , cdm_root_1 r where l.END2_ID=r.CMDB_ID and r.A_ROOT_CLASS='installed_software')
    SELECT count(*) from HDM_170910CONTAINMENT_1 where CMDB_ID IN ( select l.CMDB_ID from link_1 l , cdm_root_1 r where l.END1_ID=r.CMDB_ID and r.A_ROOT_CLASS='installed_software')

The following logs should be seen when removing the qualifier from UI(enabling history for the selected CIT):

INFO   [qtp1197761641-589] - ------------------ Starting alignment for class installed_software ------------------
INFO   [qtp1197761641-589] - Align will be done for all descendant classes of class [installed_software]
INFO   [qtp1197761641-589] - Start align for Class [installed_software]
INFO   [qtp1197761641-589] - Class installed_software is new (has no registry of current table name). Going to create history tables for it.
INFO   [qtp1197761641-589] - Going to create history tables for class installed_software
INFO   [qtp1197761641-589] - Table name for class installed_software: HDM_170510INSTALL_867021642
INFO   [qtp1197761641-589] - Created table HDM_170510INSTALL_867021642 for class [installed_software]
INFO   [qtp1197761641-589] - Created table for removed CIs HDMR_INSTALLED_SOFTWARE_1 for class [installed_software]
INFO   [qtp1197761641-589] - Created table for removed CIs HDMR_INSTALLED_SOFTWARE_1 for class [installed_software]
INFO   [qtp1197761641-589] - Created list attributes table HDML_170510INSTALL_867021642 for for class [installed_software]
INFO   [qtp1197761641-589] - Created list attributes table for removed CIs HDMRL_INSTALLED_SOFTWARE_1 for for class [installed_software]
INFO   [qtp1197761641-589] - Created list attributes table for removed CIs HDMRL_INSTALLED_SOFTWARE_1 for for class [installed_software]
INFO   [qtp1197761641-589] - Finished to create history tables for class installed_software

For large environments, adding the CIT_NOT_TRACKED_FOR_HISTORY qualifier may take longer depending on the environment activity and its performance as well as UCMDB Database performance. It the operation fails with an operation timeout or sql query timeout increase the timeout specified and add the qualifier again after a server restart.

If the operation fails with an error, the CIT_NOT_TRACKED_FOR_HISTORY qualifier should be added to the CIT, and it should work as expected. However, not all history instances were deleted from history tables. You can check these instances directly in the database using similar SQL queries like the ones presented above. (Only the tables names and class name should match the required CIT). Same queries can be converted to delete statements to clean the history tables from CI instances that should be removed.