Quantcast
Channel: SQL Server Replication forum
Viewing all articles
Browse latest Browse all 4054

Script to Monitor Undistributed Commands on Subscriber

$
0
0

Hi All,

I am a SQL DBA with no scripting knowledge. I am looking for a simple script which sends an email if "pendingcmdcount" value is greater than x. 

to summarize , 

I want to make use of below query 

USE DISTRIBUTION
GO
EXECUTE sp_replmonitorsubscriptionpendingcmds  
  @publisher ='****', -- Put publisher server name here
  @publisher_db = '****', -- Put publisher database name here
  @publication ='****',  -- Put publication name here
  @subscriber ='****', -- Put subscriber server name here
  @subscriber_db ='****', -- Put subscriber database name here
  @subscription_type ='0' -- 0 = push and 1 = pull

which typically returns just 1 row for "pendingcmdcount" and "estimatedprocesstime" 

How can i make use of TSQL in such a way that an email is triggered if value returned under "pendingcmdcount" is greater than a certain number. I have the code for email. I am looking for logic.

Thanks a lot in advance. 




Viewing all articles
Browse latest Browse all 4054

Trending Articles