Network Management

"Violation of PRIMARY KEY constraint 'PK_Accounts'" error in Configuration Wizard

The Configuration Wizard fails during an upgrade with the error inserting a duplicate key in object dbo.Accounts. The duplicate key value is (Admin). The statement has been terminated.

First published date

3/10/2021 7:32 PM

Last published date

7/9/2025 7:20 PM

Overview

Error received from running the Configuration Wizard:

ERROR TaskAdapter - Error running task Orion.ConfigureDatabase Orion Database
System.Data.SqlClient.SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_Accounts'. Cannot insert duplicate key in object 'dbo.Accounts'. The duplicate key value is (Admin).
The statement has been terminated.



 

Product section

Orion Platform

Cause

Configuration Wizard is inserting a duplicate account into the database which violates the primary key constraint of the table.

Resolution

Important: 

Contact SolarWinds support if you're unfamiliar with running SQL statements. 

DO NOT attempt these without a Database backup


The steps below are written for cases where the duplicate entry involves the Admin account. If the error you're encountering is related to a different user account, you can still follow the same steps, but you would need to update the queries to match the affected account. 

 

  1. Start and stop Orion services.
    How to Start, Stop, or Restart Orion Services with the Orion Service Manager in Orion Platform
  2. Use Database Manager to view the SolarWinds database.
    Use Database Manager utility to view the SolarWinds Orion database
  3. 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.
DELETE FROM [Accounts] WHERE AccountID = 'Admin'

        4. 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.
DELETE FROM [dbo].[WebUserSettings] WHERE AccountID = 'Admin' 

         5. Re-run the SolarWinds Configuration Wizard.