- Flexera Community
- :
- FlexNet Manager
- :
- FlexNet Manager Forum
- :
- Database Migration Failing for Compliance Database
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Fawad Laiq
- Mark as New
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This error suggests that:
- You have a custom asset type named "Mainframe" defined.
- The migration process tries to add a new built-in asset type named "Mainframe".
- This fails because of the name conflict.
This is untested, but an approach to explore to see whether it works to handle this is:
- Before commencing the migration, rename the custom asset type:
UPDATE AssetType SET AssetTypeName = 'Custom-Mainframe' WHERE AssetTypeName = 'Mainframe'
- Perform the database migration
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.
- Mark as New
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This error suggests that:
- You have a custom asset type named "Mainframe" defined.
- The migration process tries to add a new built-in asset type named "Mainframe".
- This fails because of the name conflict.
This is untested, but an approach to explore to see whether it works to handle this is:
- Before commencing the migration, rename the custom asset type:
UPDATE AssetType SET AssetTypeName = 'Custom-Mainframe' WHERE AssetTypeName = 'Mainframe'
- Perform the database migration
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.
- Mark as New
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Fawad Laiq
