Network Management
Violation of PRIMARY KEY constraint 'PK_DeviceTypeViews'. Cannot insert duplicate key in object 'dbo.ViewsByDeviceType' after upgrading to SolarWinds Platform 2024.2
This article explains how to resolve the Configuration Wizard error encountered usually during an upgrade to SolarWinds Platform 2024.2
First published date
Last published date
Overview
in the Configuration Wizard log, you may see the following error message:
Error while executing script- Violation of PRIMARY KEY constraint 'PK_DeviceTypeViews'. Cannot insert duplicate key in object 'dbo.ViewsByDeviceType'. The duplicate key value is (Meraki Networks Cloud Orchestrator). Violation of PRIMARY KEY constraint 'PK_DeviceTypeViews'. Cannot insert duplicate key in object 'dbo.ViewsByDeviceType'. The duplicate key value is (VeloCloud Orchestrator). Violation of PRIMARY KEY constraint 'PK_DeviceTypeViews'. Cannot insert duplicate key in object 'dbo.ViewsByDeviceType'. The duplicate key value is (Viptela Orchestrator). The statement has been terminated. The statement has been terminated. The statement has been terminated. at SolarWinds.ConfigurationWizard.Plugin.Common.DBConfigProcessor.ExecuteSqlBatch(IDbConnection connection, String sqlQuery, ConfigurationLogDelegate configLog) at SolarWinds.ConfigurationWizard.Plugin.Common.DBConfigProcessor.Process(IDbConnection connection, ConfigurationProgressDelegate progress, String scriptFile,
Note: The duplicate key reference may be different, but the solution applies to all.
Product section
Cause
This issue occurs due to duplicate keys are often associated with upgrade to SolarWinds Platform 2024.2 and impact multiple keys in the SDWan Orchestrator and Wireless Controllers views.
Resolution
To resolve the issue, please upgrade to SolarWinds Platform 2024.4 and above. If an upgrade is not possible, perform the workaround below:
- Backup database
- Run Database Manager as admin
- On the main SolarWinds Platform database, execute the following query
-- 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. ALTER TABLE dbo.ViewsByDeviceType DROP CONSTRAINT PK_DeviceTypeViews;
- Re-run Configuration Wizard
While dropping constraints is not advised, running the configuration wizard will rebuild the proper constraints again.