Network Management

Violation of PRIMARY KEY constraint 'PK_VoipCDRs'. Cannot insert duplicate key in object 'dbo.VoipCDRs

This issue will often cause the VoIP search page not to show. This article will show you how to remove the duplicate keys to resolve this issue

First published date

11/30/2022 11:01 PM

Last published date

11/30/2022 11:01 PM

Overview

The following log:
C:\ProgramData\SolarWinds\Logs\IPSLAM\IpSla.BusinessLayer.log

Will show errors like this:

2022-11-12 22:43:49,894 [CdrBulkInsertWorker] ERROR SolarWinds.Orion.IpSla.Data.DAL.Db.DbCdrDAL (null) - Error occured during bulk insert to dbo.[VoipCDRs]: System.Data.SqlClient.SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_VoipCDRs'. Cannot insert duplicate key in object 'dbo.VoipCDRs'. The duplicate key value is (Nov  9 2022  8:37PM, 2, 5006703, a74acc1a-0f65-438a-b55d-2aa11da2b7e2).

Product section

VoIP & Network Quality Manager

Cause

Duplicate keys are often associated with upgrades

Resolution

1. Backup database
2. Run Orion Database Manager as admin
3. On the main Orion 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 VoipCDRs
DROP CONSTRAINT PK_VoipCDRs;

4. Run Configuration Wizard

VoIP search page should now appear.