The “writer” phase of the inventory import process may fail with an error message like the following:
2021-10-24 19:12:29,746 [INFO ] WriteComputers - Insert new computers 2021-10-24 19:12:56,731 [INFO ] Failed to execute Writer 'WriteComputers - Insert new computers' from file C:\ProgramData\Flexera Software\Compliance\ImportProcedures\Inventory\Writer\Computer.xml, at step line 544 Error: The DELETE statement conflicted with the REFERENCE constraint "CloudServiceApplicationWithByol_ComplianceComputer". The conflict occurred in database "FNMSCompliance", table "dbo.CloudServiceApplicationWithByol_MT", column 'ComplianceComputerID'. Synchronized 0 row(s) of table 'ComplianceComputerPerOperator_PC' (234 ms) Synchronized 0 row(s) of table 'ComplianceComputerPerOperator_PC' (94 ms) The statement has been terminated.
This error occurs due to a logic error related to removing inventory device records in the database that have a status of “awaiting inventory” when they need to be replaced with an active inventory device record.
If the following query returns any results when executed against the compliance database then the current state of data is liable to trigger this issue to occur:
SELECT * FROM dbo.ComplianceComputer cc JOIN dbo.CloudServiceApplicationWithByol csab ON csab.ComplianceComputerID = cc.ComplianceComputerID wHERE cc.ComplianceComputerStatusID = 4 /* awaiting inventory */
When this issue occurs, the following SQL statements can be executed against the compliance database to clean up problematic data.
UPDATE csi SET HostComplianceComputerID = NULL FROM dbo.CloudServiceInstance_MT csi INNER JOIN ComplianceComputer d ON d.ComplianceComputerID = csi.HostComplianceComputerID WHERE d.ComplianceComputerStatusID = 4 UPDATE csi SET ComplianceComputerID = NULL, MatchingRuleID = NULL, InventoryDate = NULL FROM dbo.CloudServiceInstance_MT csi INNER JOIN ComplianceComputer d ON d.ComplianceComputerID = csi.ComplianceComputerID WHERE d.ComplianceComputerStatusID in = 4 UPDATE csab SET ComplianceComputerID = NULL, SoftwareTitleID = NULL, CloudLicenseTypeID = NULL, Overridden = 0 FROM dbo.CloudServiceApplicationWithByol_MT csab INNER JOIN ComplianceComputer d ON d.ComplianceComputerID = csab.ComplianceComputerID WHERE d.ComplianceComputerStatusID = 4
Be aware that this is only a temporary mitigation, as new problematic data may arise and cause future imports to fail in the same way - in which case these statements can be re-executed.
This issue has been fixed in the following FlexNet Manager Suite releases: 2022 R1.5 / Aug 2022 (Cloud), 2022 R2 (On Premises)
Affected components: Inventory import (read/write/export)
Master issue ID: IOJ-2228768
Also known as: FNML-74620
Aug 05, 2022 02:30 AM - edited Nov 20, 2023 01:29 PM