Cleaning up faulty CMDB status entries
Problem
Faulty CMDB status entries exist in i-doit that cannot be deleted via the user interface. These may have been caused by faulty imports or manual database changes.
Preparation
Create a complete backup before making any database changes.
Default CMDB statuses must not be deleted. These are identified by a constant in the field isys_cmdb_status__const (e.g. C__CMDB_STATUS__IN_OPERATION). Only entries without a constant are user-defined and can be removed.
Step 1: Identify faulty status entries
SELECT * FROM isys_cmdb_status;
Note the ID of the faulty entry (column isys_cmdb_status__id).
Step 2: Check affected objects
SELECT * FROM isys_obj
WHERE isys_obj__isys_cmdb_status__id = <FAULTY_ID>;
If objects use this status, they must first be moved to a valid status.
Step 3: Correct objects
UPDATE isys_obj
SET isys_obj__isys_cmdb_status__id = <CORRECT_ID>
WHERE isys_obj__isys_cmdb_status__id = <FAULTY_ID>;
The ID of the desired target status can be found in the query from Step 1 (e.g. 6 for "In operation").
Step 4: Delete faulty status
DELETE FROM isys_cmdb_status
WHERE isys_cmdb_status__id = <FAULTY_ID>
AND isys_cmdb_status__const IS NULL;
The condition isys_cmdb_status__const IS NULL ensures that no default statuses are accidentally deleted.
Detailed documentation: CMDB status in the Knowledge Base
Comments
0 comments
Please sign in to leave a comment.