Subscription Pending Commands

Microsoft.SQLServer.Replication.Windows.Monitor.SubscriptionPendingCmdsMonitor (UnitMonitor)

There are pending commands on the Distributor for specific Subscription waiting delivery. Note that this monitor is disabled for Merge Subscriptions.

Knowledge Base article:

Summary

A large number of commands in the Distribution database have not been delivered to the selected Subscriber. Note that this monitor is disabled for Merge Subscriptions.

The monitor collects this information and displays to the user. The data can be acquired in the same way as the Replication Monitor does.

Causes

The Distribution Agent may be stopped.

Large transactions with many commands committed on the Publisher database and replicated to the Distribution database.

The Distribution Agent may be experiencing performance issues reading from the Distribution database or writing to the Subscriber database.

Resolutions

Address any issues if the Distribution Agent stopped and restart the Agent.

If the alert is due to large transactions in Publisher database, evaluate the estimated time of delivery. Consider re-initializing the subscription.

If the Distribution Agent is experiencing slow performance in reading from the Distribution database, run update statistics with the fullscan option against the Distribution tables. If the performance issues are experienced when writing to the Subscriber, check and address any blockings or resources waits.

Overrideable Parameters

Name

Description

Default Value

Alert Priority

Defines Alert Priority.

Normal

Alert Severity

Defines Alert Severity.

Warning

Enabled

Enables or disables the workflow.

Yes

Generates Alerts

Defines whether the workflow generates an Alert.

Yes

Interval (seconds)

The recurring interval of time in seconds in which to run the workflow.

300

Number of samples

Indicates how many times a measured value should breach a threshold before the state is changed.

6

Synchronization Time

The synchronization time specified by using a 24-hour format. May be omitted.

 

Warning Threshold

Warning Threshold.

20

Timeout (seconds)

Specifies the time the workflow is allowed to run before being closed and marked as failed.

200

Timeout for database connection (seconds)

The workflow will fail and register an event if it cannot access the database during the specified period.

15

Element properties:

TargetMicrosoft.SQLServer.Replication.Windows.Subscription
Parent MonitorSystem.Health.PerformanceState
CategoryPerformanceHealth
EnabledTrue
Alert GenerateTrue
Alert SeverityWarning
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.SQLServer.Replication.Windows.MonitorType.SubscriptionPendingCmds
RemotableTrue
AccessibilityPublic
Alert Message
MSSQL on Windows Replication: A high number of commands in the Distribution database are waiting to be applied.
The Subscription '{0}' has detected a high number of commands waiting to be applied.
Number of commands: {1}
RunAsMicrosoft.SQLServer.Core.RunAs.Monitoring

Source Code:

<UnitMonitor ID="Microsoft.SQLServer.Replication.Windows.Monitor.SubscriptionPendingCmdsMonitor" Accessibility="Public" Enabled="true" Target="SQLReplWD!Microsoft.SQLServer.Replication.Windows.Subscription" ParentMonitorID="Health!System.Health.PerformanceState" Remotable="true" Priority="Normal" TypeID="Microsoft.SQLServer.Replication.Windows.MonitorType.SubscriptionPendingCmds" ConfirmDelivery="false" RunAs="SqlCoreLib!Microsoft.SQLServer.Core.RunAs.Monitoring">
<Category>PerformanceHealth</Category>
<AlertSettings AlertMessage="Microsoft.SQLServer.Replication.Windows.Monitor.SubscriptionPendingCmds.AlertMessage">
<AlertOnState>Warning</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>Warning</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Target/Property[Type='MSRL!Microsoft.SQLServer.Replication.Core.GenericSubscription']/SubscriptionName$</AlertParameter1>
<AlertParameter2>$Data/Context/Property[@Name='SubscriptionPendingCmds']$</AlertParameter2>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Health" MonitorTypeStateID="Health" HealthState="Success"/>
<OperationalState ID="Warning" MonitorTypeStateID="Warning" HealthState="Warning"/>
</OperationalStates>
<Configuration>
<MachineName>$Target/Host/Host/Property[Type='SqlCoreLib!Microsoft.SQLServer.Core.DBEngine']/MachineName$</MachineName>
<NetbiosComputerName>$Target/Host/Host/Property[Type='SqlCoreLib!Microsoft.SQLServer.Core.DBEngine']/NetbiosComputerName$</NetbiosComputerName>
<InstanceName>$Target/Host/Host/Property[Type='SqlCoreLib!Microsoft.SQLServer.Core.DBEngine']/InstanceName$</InstanceName>
<SqlTimeoutSeconds>15</SqlTimeoutSeconds>
<ConnectionString>$Target/Property[Type="MSRL!Microsoft.SQLServer.Replication.Core.GenericSubscription"]/Distributor$</ConnectionString>
<MonitoringType>$Target/Host/Host/Property[Type="SqlDiscW!Microsoft.SQLServer.Windows.DBEngine"]/MonitoringType$</MonitoringType>
<SubscriptionType>$Target/Property[Type="MSRL!Microsoft.SQLServer.Replication.Core.GenericSubscription"]/Type$</SubscriptionType>
<PublisherName>$Target/Property[Type="MSRL!Microsoft.SQLServer.Replication.Core.GenericSubscription"]/Publisher$</PublisherName>
<Subscriber>$Target/Property[Type="MSRL!Microsoft.SQLServer.Replication.Core.GenericSubscription"]/Subscriber$</Subscriber>
<PublisherDb>$Target/Property[Type="MSRL!Microsoft.SQLServer.Replication.Core.GenericSubscription"]/PublicationDatabase$</PublisherDb>
<SubscriberDb>$Target/Property[Type="MSRL!Microsoft.SQLServer.Replication.Core.GenericSubscription"]/SubscriptionDatabase$</SubscriberDb>
<Publication>$Target/Property[Type="MSRL!Microsoft.SQLServer.Replication.Core.GenericSubscription"]/PublicationName$</Publication>
<Threshold>20</Threshold>
<NumSamples>6</NumSamples>
<IntervalSeconds>300</IntervalSeconds>
<SyncTime/>
<TimeoutSeconds>200</TimeoutSeconds>
<CheckMachineAndInstanceName>false</CheckMachineAndInstanceName>
</Configuration>
</UnitMonitor>