Share via

How to Script off SQL Replication "warning" setting for an Alert

Mark Gordon 926 Reputation points
2021-01-04T17:55:02.267+00:00

Fellow SQL ers,

I am starting to setup some replication warnings/alerts.
After doing some testing, I do not understand how to script off what you may have setup for the warning trigger.
For example, you have transaction replication running. Pull subscription. You want to be alerted if there is high latency.
You go to Replication Monitor, open up the publisher object and select Warning. You click on the warning for transaction latency and setup the value you want to be the limit. You click on Configure Alerts. You setup the Alert with necessary values for email, operators etc..

Done.

So now you want to script off the part of that which was for the Warning. I find no way to do it. Yes, you can script off the alert but that does not refer back to the value that you used in the warning to trigger it.

I have scripted off the publish object and subscriber and have not found any reference to the warning I enabled.

How does one capture this for future use?

Thanks
MG

SQL Server | Other
SQL Server | Other

Additional SQL Server features and topics not covered by specific categories

0 comments No comments

Answer accepted by question author

Cris Zhan-MSFT 6,676 Reputation points
2021-01-05T10:22:13.957+00:00

Hi @Mark Gordon ,

> I find no way to do it. Yes, you can script off the alert but that does not refer back to the value that you used in the warning to trigger it.

The threshold is set in Replication Monitor, this value is not included when scripting the alert .

About using replication Monitor or other ways to monitor replication , here is a article for your reference.
https://www.brentozar.com/archive/2014/07/monitoring-sql-server-transactional-replication/

Was this answer helpful?


1 additional answer

Sort by: Most helpful
  1. Tom Phillips 17,786 Reputation points
    2021-01-04T18:59:25.35+00:00

    This does not answer your question. But I do not recommend using those alerts and instead using something like this. It is much more flexible and you can schedule an agent job to run only during the hours you want to monitor.

    https://www.mssqltips.com/sqlservertip/2258/monitor-sql-server-replication-latency-using-tracer-tokens/

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.