Database Management

SQL Sentry - History Synchronization Failed: An error has occurred FAQ

This article will show how to resolved history synchronization failed error.

First published date

7/16/2021 1:03 PM

Last published date

2/7/2025 6:34 PM

Overview

To fix the history synchronization failed error, go to the affected server instance, stop watching the instance, run the appropriate uninstall script, and re-watch the instance.

Product section

SQL Sentry (SQLS)

Cause

Error: History Synchronization Failed

Resolution

Step-by-step guide

  1. Right-click on the affected server instance in the Navigator pane
  2. Select Stop Watching > Instance
  3. Run the appropriate uninstall script from the following location:  https://docs.sentryone.com/help/remove-watched-targets#sql-server-2005-instances

     

    Object Removal 2005+ 
  4. -- 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.
    
    --SQL Server 2005+
    USE msdb
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[sp_sentry_mail]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
    drop procedure [dbo].[sp_sentry_mail]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[sp_sentry_mail_20]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
    drop procedure [dbo].[sp_sentry_mail_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[sp_sentry_dbmail_20]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
    drop procedure [dbo].[sp_sentry_dbmail_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[SQLSentryEmails_20]') and OBJECTPROPERTY(object_id, N'IsUserTable') = 1)
    drop table [dbo].[SQLSentryEmails_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[SQLSentryDBEmails_Attachments_20]') and OBJECTPROPERTY(object_id, N'IsUserTable') = 1)
    drop table [dbo].[SQLSentryDBEmails_Attachments_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[SQLSentryDBEmails_20]') and OBJECTPROPERTY(object_id, N'IsUserTable') = 1)
    drop table [dbo].[SQLSentryDBEmails_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[spGetBlockInfo_20]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
    drop procedure [dbo].[spGetBlockInfo_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[spGetBlockInfo_Pre8sp3]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
    drop procedure [dbo].[spGetBlockInfo_Pre8sp3]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[spGetQueryStatsData]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
    drop procedure [dbo].[spGetQueryStatsData]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[spGetProcedureStatsData]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
    drop procedure [dbo].[spGetProcedureStatsData]
    GO
    BEGIN TRANSACTION
    DECLARE @JobID BINARY(16)
    DECLARE @ReturnCode INT
    SELECT @ReturnCode = 0
    -- Delete the job with the same name (if it exists)
    SELECT @JobID = job_id
    FROM msdb.dbo.sysjobs
    WHERE (name = N'SQL Sentry 2.0 Queue Monitor')
    IF (@JobID IS NOT NULL)
    BEGIN
    -- Check if the job is a multi-server job
    IF (EXISTS (SELECT *
    FROM msdb.dbo.sysjobservers
    WHERE (job_id = @JobID) AND (server_id <> 0)))
    BEGIN
    -- There is, so abort the script
    RAISERROR (N'Unable to import job ''SQL Sentry Queue Monitor'' since there is already a multi-server job with this name.', 16, 1)
    GOTO QuitWithRollback
    END
    ELSE
    -- Delete the [local] job
    EXECUTE msdb.dbo.sp_delete_job @job_name = N'SQL Sentry 2.0 Queue Monitor'
    SELECT @JobID = NULL
    END
    COMMIT TRANSACTION
    GOTO EndSave QuitWithRollback:
    IF (@@TRANCOUNT > 0) ROLLBACK TRANSACTION
    EndSave:
    GO
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[spGetJobInfo_20]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
    drop procedure [dbo].[spGetJobInfo_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[spGetDTSLog_20]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
    drop procedure [dbo].[spGetDTSLog_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[spQueueHeartbeat_20]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
    drop procedure [dbo].[spQueueHeartbeat_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[spQueueJob_Start_20]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
    drop procedure [dbo].[spQueueJob_Start_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[spQueueJob_End_20]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
    drop procedure [dbo].[spQueueJob_End_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[spQueueMonitor_20]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
    drop procedure [dbo].[spQueueMonitor_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[spReadLogFile_20]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
    drop procedure [dbo].[spReadLogFile_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[SQLSentryQueueLog_20]') and OBJECTPROPERTY(object_id, N'IsUserTable') = 1)
    drop table [dbo].[SQLSentryQueueLog_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[SQLSentryLogCache_20]') and OBJECTPROPERTY(object_id, N'IsUserTable') = 1)
    drop table [dbo].[SQLSentryLogCache_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[SQLSentryLogCacheDTS_20]') and OBJECTPROPERTY(object_id, N'IsUserTable') = 1)
    drop table [dbo].[SQLSentryLogCacheDTS_20]
    GO
    BEGIN TRANSACTION
    DECLARE @JobID BINARY(16)
    DECLARE @ReturnCode INT
    SELECT @ReturnCode = 0
    -- Delete the job with the same name (if it exists)
    SELECT @JobID = job_id
    FROM msdb.dbo.sysjobs
    WHERE (name = N'SQL Sentry 2.0 Alert Trap')
    IF (@JobID IS NOT NULL)
    BEGIN
    -- Check if the job is a multi-server job
    IF (EXISTS (SELECT *
    FROM msdb.dbo.sysjobservers
    WHERE (job_id = @JobID) AND (server_id <> 0)))
    BEGIN
    -- There is, so abort the script
    RAISERROR (N'Unable to import job ''SQL Sentry Alert Trap'' since there is already a multi-server job with this name.', 16, 1)
    GOTO QuitWithRollback
    END
    ELSE
    -- Delete the [local] job
    EXECUTE msdb.dbo.sp_delete_job @job_name = N'SQL Sentry 2.0 Alert Trap'
    SELECT @JobID = NULL
    END
    COMMIT TRANSACTION
    GOTO EndSave QuitWithRollback:
    IF (@@TRANCOUNT > 0) ROLLBACK TRANSACTION
    EndSave:
    GO
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[spTrapAlert_20]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
    drop procedure [dbo].[spTrapAlert_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[spSetupAlertsTrap_20]') and OBJECTPROPERTY(object_id, N'IsProcedure') = 1)
    drop procedure [dbo].[spSetupAlertsTrap_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[SQLSentryAlertLog_20]') and OBJECTPROPERTY(object_id, N'IsUserTable') = 1)
    drop table [dbo].[SQLSentryAlertLog_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[SQLSentryLogData_20]') and OBJECTPROPERTY(object_id, N'IsUserTable') = 1)
    drop table [dbo].[SQLSentryLogData_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[SQLSentryObjectVersion_20]') and OBJECTPROPERTY(object_id, N'IsUserTable') = 1)
    drop table [dbo].[SQLSentryObjectVersion_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[fnGetSQL_20]') and OBJECTPROPERTY(object_id, N'IsScalarFunction') = 1)
    drop function [dbo].[fnGetSQL_20]
    if exists (select * from sys.objects where object_id = object_id(N'[dbo].[fnGetWaittypeDesc_20]') and OBJECTPROPERTY(object_id, N'IsScalarFunction') = 1)
    drop function [dbo].[fnGetWaittypeDesc_20]
    if exists (select * from sys.objects where object_id = object_id(N'[SQLSentry].[SQLSentryObjectVersion_20]') and OBJECTPROPERTY(object_id, N'IsUserTable') = 1)
    drop table [SQLSentry].[SQLSentryObjectVersion_20]
  5. Right-click on the affected server instance in the Navigator pane.
  6. Select Watch.