This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Orion NPM Upgrade Error - Violation of PRIMARY KEY constraint

FormerMember
FormerMember

Trying to upgrade old version of Orion NPM and APM (now SAM) to newest versions.  There is a matrix of upgrades we must go through.  When upgrading to NPM 10.2.2 we get the following error during the Configuration Wizard step:

Database configuration failed:
• Error while executing script- Violation of PRIMARY KEY constraint 'PK_APM_Tag'. Cannot insert duplicate key in object 'dbo.APM_Tag'.
The statement has been terminated.


The closest support document I can find that is related to our error is http://knowledgebase.solarwinds.com/kb/questions/3923/Configuration+Wizard+fails+when+upgrading+NPM+10.2.2+to+10.3

They recommend running this SQL statement:


IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[NetFlowTransactionLog]') AND name = N'PK_NetFlowTransactionLog')

ALTER TABLE [dbo].[NetFlowTransactionLog] DROP CONSTRAINT [PK_NetFlowTransactionLog]


If I run that and replace NetFlowTransactionLog with APM_Tag do you think it would let the configuration wizard complete, upgrade the database, create all the necessary services, etc?

  • There's probably going to be a bit more to that, you'd first need to find the table that this primary key is on.  To do this, do a search on your server for the ConfigurationWizard.log and look for that error to see what table this is coming from.  Once that is determined, you should be able to remove the key and reconfigure to have that key re-added and continue you upgrade.

    Regards,

    Matthew Harvey

    Loop1 Systems

    http://www.loop1systems.com

  • FormerMember
    0 FormerMember in reply to mharvey

    Well it's telling me in the error that it's having trouble working with the APM_Tag table.  I'm assuming that's where the primary key is as well?  That article I linked to was the same error on a different table, figured it would work if I substituted the table names.

  • FormerMember
    0 FormerMember

    Just FYI in case anyone else ever encounters this error, this is the exact command I ran on the SQL server to fix the problem and let the configuration wizard complete everything.  I'm good to go now.

    IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[APM_Tag]') AND name = N'PK_APM_Tag')
    ALTER TABLE [dbo].[APM_Tag] DROP CONSTRAINT [PK_APM_Tag]

    If you look at the contents of the APM_Tag table it is really trivial content anyway.  I won't even add back the constraint, if the config wizard didn't do it already.