• stakes (12/9/2010)


    Got the solution!

    To get the Alert working, you should leave the Type to 'SQL Server event alert', database name to <all databases> and the error number to 14161. The problem is that the Alert won't fire, because the shouldalert parameter isn't set to 1 (which to my opinion automatically should be done when configuring Replication or the Alert). To see if the shouldalert parameter is set to 0 or 1, execute:

    SELECT TOP 2 [publication_id]

    ,[metric_id]

    ,[value]

    ,[shouldalert]

    ,[isenabled]

    FROM [distribution].[dbo].[MSpublicationthresholds]

    To change it:

    exec [distribution].sys.sp_replmonitorchangepublicationthreshold

    @publisher = N'STSQLSERVER3',

    @publisher_db = N'AdventureWorks',

    @publication = N'AWPersonPublication',

    @metric_id = 2,--metric_id 1=latency, 2=subscription expire

    @value = 30,--Enter Threshold here

    @shouldalert = 1,

    @mode = 1

    As you can see, you can also change the Threshold value with this command. Another tip: the Warnings tab in the Replication Monitor doesn't refresh automatically. So do that if you want to see the result after executing the above command.

    I was adding multiple articles at a time and I was getting errors like can't find Objects that have articles that were already replicated.

    I do not want to only add one article at a time.

    If replication stops for any reason I want to fire an Alert.

    How can this be done?

    Thanks.

    For better, quicker answers on T-SQL questions, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/