Network Management

"PK_APM_SqlBbConnection is not a constraint. Could not drop constraint." after upgrading to SolarWinds Platform 2024.4 or 2025.1

This article contains the steps to address the error from the Configuration Wizard upgrading to the SolarWinds Platform 2024.4 or 2025.1

First published date

12/3/2024 2:40 AM

Last published date

5/1/2025 8:29 PM

Overview

After upgrading to SolarWinds Platform 2024.4 or 2025.1, the following error message may appear

ERROR TaskAdapter - Error running task Orion.ConfigureDatabase SolarWinds Platform Database SolarWinds.ConfigurationWizard.Common.ConfigurationException: Error while executing script- 'PK_APM_SqlBbConnection' is not a constraint. Could not drop constraint.

Product section

Network Performance Monitor

Cause

This issue occurs due to an incorrect SQL logic for the PK_APM_SqlBbConnection store procedure added in SolarWinds Platform 2024.4.

Resolution

Recommended Resolution: Upgrade to 2025.1.1
A permanent fix for this issue has been implemented in SolarWinds Platform 2025.1.1. The service release is now available for download in the Customer Portal.
We highly recommend upgrading to 2025.1.1 to resolve this issue.
 
Alternative Workaround
If an immediate upgrade is not possible, please use the workaround below:
 

Important:

Perform Database backup (snapshots) first before applying the steps provided

Please note the following for all scripts below:

  1. Go to the SolarWinds installation folder (default installation catalog is C:\Program Files\SolarWinds\Orion)
  2. Find and open in the text editor file OrionCoreDatabaseScheme.dbConfig
  3. Find below part of the script in this file:
IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'APM_SqlBbConnection' AND COLUMN_NAME = 'TimeStamp' AND COLUMN_NAME = 'ConnectTime' AND DATA_TYPE='datetime2')
BEGIN
	ALTER TABLE APM_SqlBbConnection DROP CONSTRAINT PK_APM_SqlBbConnection;   
	ALTER TABLE APM_SqlBbConnection ALTER COLUMN TimeStamp [datetime2](7) NOT NULL;
	ALTER TABLE APM_SqlBbConnection ADD CONSTRAINT [PK_APM_SqlBbConnection] PRIMARY KEY CLUSTERED
	(
		[TimeStamp] ASC,
		[ApplicationID] ASC,
		[ServerSessionID] ASC
	)ON [PRIMARY];
	ALTER TABLE APM_SqlBbConnection ALTER COLUMN ConnectTime [datetime2](7) NOT NULL;
END

Change this part of code with below code and save the file:

IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'APM_SqlBbConnection' AND COLUMN_NAME = 'TimeStamp' AND DATA_TYPE='datetime')
BEGIN
	ALTER TABLE APM_SqlBbConnection DROP CONSTRAINT PK_APM_SqlBbConnection;
	ALTER TABLE APM_SqlBbConnection ALTER COLUMN TimeStamp [datetime2](7) NOT NULL;
	ALTER TABLE APM_SqlBbConnection ADD CONSTRAINT [PK_APM_SqlBbConnection] PRIMARY KEY CLUSTERED
	(
		[TimeStamp] ASC,
		[ApplicationID] ASC,
		[ServerSessionID] ASC
	)ON [PRIMARY];
END

IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'APM_SqlBbConnection' AND COLUMN_NAME = 'ConnectTime' AND DATA_TYPE='datetime')
BEGIN
	ALTER TABLE APM_SqlBbConnection ALTER COLUMN ConnectTime [datetime2](7) NOT NULL;
END

Check if the APM_SqlBbConnection table contains constraints, you can do it by running the below script: 

select * from INFORMATION_SCHEMA.TABLE_CONSTRAINTS where CONSTRAINT_NAME = 'PK_APM_SqlBbConnection'

5a. If table CONTAINS constraint just run configuration wizard
5b. If the table DOESN’T CONTAIN any constraint you should add some to unblock the config wizard, you can alter a table with the below script:

ALTER TABLE APM_SqlBbConnection ADD CONSTRAINT [PK_APM_SqlBbConnection] PRIMARY KEY CLUSTERED
	(
		[TimeStamp] ASC,
		[ApplicationID] ASC,
		[ServerSessionID] ASC
	)ON [PRIMARY];
  1. Run the Configuration Wizard