Network Management
LazyUpgradeStatus Migration fails with "Could not create constraint or index" error due to duplicate data in SolarWinds Platform 2025.4
This article provides guidance to identify and resolve common errors encountered during data migration.
First published date
Last published date
Overview
Data migration may fail with an error similar to the below:
dbm_Migrate2Partitioned: Could not create constraint or index. See previous errors.
ALTER TABLE APM_HardwareItem_CS_stg WITH CHECK ADD CONSTRAINT CHK_APM_HardwareItem_CS_stg CHECK ([Timestamp] >= '20250427' AND [Timestamp] < '20250428')
Product section
Resolution
Please note the following for each query below:
-- Scripts are not supported under any SolarWinds support program or service.
-- Scripts are provided AS IS without warranty of any kind. SolarWinds further
-- disclaims all warranties including, without limitation, any implied warranties
-- of merchantability or of fitness for a particular purpose. The risk arising
-- out of the use or performance of the scripts and documentation stays with you.
-- In no event shall SolarWinds or anyone else involved in the creation,
-- production, or delivery of the scripts be liable for any damages whatsoever
-- (including, without limitation, damages for loss of business profits, business
-- interruption, loss of business information, or other pecuniary loss) arising
-- out of the use of or inability to use the scripts or documentation.
- Connect to the SQL server and open SQL Server Management Studio.
- Log in to SSMS with SQL Admin credentials.
- Take a backup of the SolarWinds Platform database.
- Open a new query window, paste the query below, and select Execute query:
WITH dupl AS (
SELECT detail.*,
ROW_NUMBER() OVER (PARTITION BY [Timestamp], HardwareItemID ORDER BY [Timestamp] DESC) AS rnk
FROM APM_HardwareItem_CS_Detail_hist detail
)
DELETE FROM dupl WHERE rnk > 1;
- Verify if the above query works by executing below query:
WITH dupl AS (
SELECT detail.*,
ROW_NUMBER() OVER (PARTITION BY [Timestamp], HardwareItemID ORDER BY [Timestamp] DESC) AS rnk
FROM APM_HardwareItem_CS_Detail_hist detail
)
SELECT * FROM dupl WHERE rnk > 1;
It should return zero rows.
- Open a new query window and run this query:
Select * from LazyUpgradeStatus where Tablename LIKE 'APM_HardwareItem%' and Granularity = 1
Here, EndDateUTC column value should not be NULL.
- Users can go to the web console, click on the Notification and if no records are listed on the table, the migration has been completed. The notification will be cleared the next day.
If the same error is observed for "Wireless_clients" as shown below:
dbm_Migrate2Partitioned: Could not create constraint or index. See previous errors.
ALTER TABLE Wireless_Clients_CS_stg WITH CHECK ADD CONSTRAINT CHK_ Wireless_Clients _CS_stg CHECK ([Timestamp] >= '20250427' AND [Timestamp] < '20250428')
- Connect to the SQL server and open SQL Server Management Studio.
- Log in to SSMS with SQL Admin credentials.
- Take a backup of the SolarWinds Platform database.
- Open a new query window, paste the query below, and select Execute query:
WITH dupl AS (
SELECT detail.*,
ROW_NUMBER() OVER (PARTITION BY [Timestamp], NodeID, [Index] ORDER BY [Timestamp] DESC) AS rnk
FROM Wireless_Clients_CS_Detail_hist detail
)
DELETE FROM dupl WHERE rnk > 1;
- Verify if the above query works by executing below query:
WITH dupl AS (
SELECT detail.*,
ROW_NUMBER() OVER (PARTITION BY [Timestamp], NodeID, [Index] ORDER BY [Timestamp] DESC) AS rnk
FROM Wireless_Clients_CS_Detail_hist detail
)
SELECT * FROM dupl WHERE rnk > 1;
It should return zero rows.
- Open a new query window and run this query:
Select * from LazyUpgradeStatus where Tablename LIKE 'Wireless_Clients%' and Granularity = 1
Here, EndDateUTC column value should not be NULL.
- Users can go to the web console, click on the Notification and if no records are listed on the table, the migration has been completed. The notification will be cleared the next day.
If the same error is observed for "APM_ComponentStatus" as shown below:
dbm_Migrate2Partitioned: Could not create constraint or index. See previous errors.
ALTER TABLE APM_ComponentStatus_CS_stg WITH CHECK ADD CONSTRAINT CHK_ APM_ComponentStatus _CS_stg CHECK ([Timestamp] >= '20250427' AND [Timestamp] < '20250428')
- Connect to the SQL server and open SQL Server Management Studio.
- Log in to SSMS with SQL Admin credentials.
- Take a backup of the SolarWinds Platform database.
- Open a new query window, paste the query below, and select Execute query:
WITH dupl AS (
SELECT detail.*,
ROW_NUMBER() OVER (PARTITION BY [Timestamp], ComponentID, [Availability] ORDER BY [Timestamp]
DESC) AS rnk
FROM APM_Componentstatus_cs_Detail_hist detail
)
DELETE FROM dupl WHERE rnk > 1;
- Verify if the above query works by executing below query:
WITH dupl AS (
SELECT detail.*,
ROW_NUMBER() OVER (PARTITION BY [Timestamp], ComponentID, [Availability] ORDER BY [Timestamp]
DESC) AS rnk
FROM APM_Componentstatus_cs_Detail_hist detail
)
SELECT * FROM dupl WHERE rnk > 1;
- Open a new query window and run this query:
Select * from LazyUpgradeStatus where Tablename LIKE 'APM_Componentstatus%' and Granularity = 1
Here, EndDateUTC column value should not be NULL.
- Users can go to the web console, click on the Notification and if no records are listed on the table, it implies that migration has been completed. Notification will be cleared the next day.