A new Flexera Community experience is coming on November 25th. Click here for more information.
Dear Members,
We are trying to upgrade FNMS 2018 R2 to 2022 R2 but Compliance Database migration is failing with below error:
There was an error while attempting to run 'cm-migr1710-migpost.sql'.
Violation of PRIMARY KEY constraint 'PK_AssetType'. Cannot insert duplicate key in object 'dbo.AssetType'. The duplicate key value is (Mainframe).
Migration step 10001, part of action set "Adding new Asset Types for Data Storage, Network Appliance and Mainframe"
- Adding 3 static rows to AssetType
The statement has been terminated.
Please find the logs attached. Please note logs are from second attempt.
Kind Regards,
Fawad
Jan 11, 2023 01:15 PM
This error suggests that:
This is untested, but an approach to explore to see whether it works to handle this is:
UPDATE AssetType
SET AssetTypeName = 'Custom-Mainframe'
WHERE AssetTypeName = 'Mainframe'
You will then end up with 2 asset types in your system: "Mainframe" and "Custom-Mainframe". If you do NOT have custom properties defined then that could be cleaned up to just use the built-in type as follows:
UPDATE a
SET AssetType = mat.AssetTypeID
FROM Asset a
JOIN AssetType mcat
ON mcat.AssetTypeID = a.AssetTypeID
AND mcat.AssetTypeName = 'Custom-Mainframe',
AssetType mat
WHERE mat.AssetTypeName = 'Mainframe'
DELETE AssetType
WHERE AssetTypeName = 'Custom-Mainframe'
If you DO have custom properties defined on your custom "Mainframe" asset type then more work would be needed to remove the custom asset type - beyond what I can easily suggest here.
Jan 11, 2023 08:06 PM
This error suggests that:
This is untested, but an approach to explore to see whether it works to handle this is:
UPDATE AssetType
SET AssetTypeName = 'Custom-Mainframe'
WHERE AssetTypeName = 'Mainframe'
You will then end up with 2 asset types in your system: "Mainframe" and "Custom-Mainframe". If you do NOT have custom properties defined then that could be cleaned up to just use the built-in type as follows:
UPDATE a
SET AssetType = mat.AssetTypeID
FROM Asset a
JOIN AssetType mcat
ON mcat.AssetTypeID = a.AssetTypeID
AND mcat.AssetTypeName = 'Custom-Mainframe',
AssetType mat
WHERE mat.AssetTypeName = 'Mainframe'
DELETE AssetType
WHERE AssetTypeName = 'Custom-Mainframe'
If you DO have custom properties defined on your custom "Mainframe" asset type then more work would be needed to remove the custom asset type - beyond what I can easily suggest here.
Jan 11, 2023 08:06 PM
Dear Chris,
Bravo!
It did work, I have used first statement and seems now migration is going on. Will keep you posted if I encounter any issues.
Jan 11, 2023 09:26 PM