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
Last published date
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
Cause
This issue occurs due to an incorrect SQL logic for the PK_APM_SqlBbConnection store procedure added in SolarWinds Platform 2024.4.
Resolution
|
Important: Perform Database backup (snapshots) first before applying the steps provided |
Please note the following for all scripts below:
- Go to the SolarWinds installation folder (default installation catalog is C:\Program Files\SolarWinds\Orion)
- Find and open in the text editor file OrionCoreDatabaseScheme.dbConfig
- 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];
- Run the Configuration Wizard