Submit a ticketCall us

AnnouncementsFace your biggest database issues head-on

Our new eCourse helps you navigate SQL Server performance blocks by teaching you how to recognize and deal with the three DBA Disruptors: Performance Hog, Blame Shifter, and Query Blocker. Register today to learn how to defend your environment and fend off menacing disruptions.

Register for your free eCourse.

Home > Success Center > Server & Application Monitor (SAM) > SAM - Knowledgebase Articles > Unable to install SAM if the database contains old data

Unable to install SAM if the database contains old data

Overview

One of the following errors appear during SAM installation where the previous version of SAM was installed:

Your database includes data from APM older than 3.0.

Invalid object name 'dbo.APM_ProcessEvidence_Detail'.

 

The original name of SolarWinds SAM was APM so you may still see references to "APM" in SAM log files and database elements.

Environment

SAM 6.2 and later

Cause 

A previous SAM version is installed that uses the same database. 

Resolution

Warning: SolarWinds strongly recommends that you backup your database before doing any work as this will make a permanent change to your database.

  1. Stop all Orion services.
  2. Log into SQL Server Management Studio and open the SolarWinds database.
  3. Execute the following script:
    DECLARE @table_object_id int
    DECLARE @table_name varchar(max)
    DECLARE @table_type varchar(max)
    DECLARE @stmt nvarchar(max)
    
    DECLARE table_cursor CURSOR FAST_FORWARD FOR
    SELECT o.object_id, o.name, o.[type]
    FROM sys.objects o
    WHERE o.[type] IN ('FN','TF','V','P','U') AND o.name LIKE 'APM_%' AND o.name NOT LIKE '%APM_Hardware%'
    ORDER BY CASE o.[type] WHEN 'U' THEN 'z' ELSE o.[type] END
    
    OPEN table_cursor
    
    FETCH NEXT FROM table_cursor INTO @table_object_id, @table_name, @table_type
    WHILE @@FETCH_STATUS=0
    
    BEGIN
    SET @stmt = CASE @table_type
    WHEN 'V' THEN 'VIEW'
    WHEN 'P' THEN 'PROCEDURE'
    WHEN 'FN' THEN 'FUNCTION'
    WHEN 'TF' THEN 'FUNCTION'
    ELSE 'TABLE'
    END
    
    SET @stmt = 'DROP '+@stmt+' ['+@table_name+']'
    PRINT @stmt
    EXEC [dbo].sp_executesql @statement = @stmt
    FETCH NEXT FROM table_cursor INTO @table_object_id, @table_name, @table_type
    END
    
    CLOSE table_cursor
    
    DEALLOCATE table_cursor
    
    IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[GetApmDbVersion]') AND xtype in (N'FN', N'IF', N'TF'))
    BEGIN
    DROP FUNCTION GetApmDbVersion
    END

    Note: To copy content without line numbers, hover over the text and click the view source button (View Source). This opens a new window where you can select and copy text without any formatting or line numbering.

     

  4. Reinstall SAM.
Last modified

Tags

Classifications

Public
/*]]>*/