Returns information on past sessions for a given replication Merge Agent, with one row returned for each session that matches the filtering criterion. This stored procedure, which is used to monitor merge replication, is executed at the Distributor on the distribution database or at the Subscriber on the subscription database.
Transact-SQL Syntax Conventions
sp_replmonitorhelpmergesession [ [ @agent_name= ] 'agent_name' ]
[ , [ @hours= ] hours ]
[ , [ @session_type= ] session_type ]
[ , [ @publisher= ] 'publisher' ]
[ , [ @publisher_db= ] 'publisher_db' ]
[ , [ @publication= ] 'publication' ]
[ @agent_name = ] ' agent_name '
Is the name of the agent.
agent_name is nvarchar(100) with no default. [ @hours = ] hours
Is the range of time, in hours, for which historical agent session information is returned.
hours is int, which can be one of the following ranges.
Returns information on past agent runs, up to a maximum of 100 runs.
Returns information on all past agent runs.
Returns information on agent runs that occurred in the last
hours number of hours. [ @session_type = ] session_type
Filters the result set based on the session end result.
session_type is int, and can be one of these values.
Agent sessions with a retry or succeed result.
Agent sessions with a failure result.
[ @publisher = ] ' publisher '
Is the name of the Publisher.
publisher is sysname, with a default of NULL. This parameter is used when executing sp_replmonitorhelpmergesession at the Subscriber. [ @publisher_db = ] ' publisher_db '
Is the name of the publication database.
publisher_db is sysname, with a default of NULL. This parameter is used when executing sp_replmonitorhelpmergesession at the Subscriber. [ @publication = ] ' publication '
Is the name of the publication.
publication is sysname, with a default of NULL. This parameter is used when executing sp_replmonitorhelpmergesession at the Subscriber.
ID of the agent job session.
Agent run status:
1 = Start 2 = Succeed 3 = In progress 4 = Idle 5 = Retry 6 = Fail StartTime datetime
Time agent job session began.
Time agent job session was completed.
Cumulative duration, in seconds, of this job session.
Number of commands uploaded during the agent session.
Number of commands downloaded during the agent session.
Number of error messages that were generated during the agent session.
ID of the error that occurred
Estimated percent of the total changes that have already been delivered in an active session.
Estimated number of seconds left in an active session.
Is the current phase of an active session, which can be one of the following.
1 = Upload 2 = Download LastMessage nvarchar(500)
Is the last message logged by Merge Agent during the session.
0 (success) or 1 (failure) sp_replmonitorhelpmergesession is used to monitor merge replication.
When executed on the Subscriber,
sp_replmonitorhelpmergesession only returns information on the last five Merge Agent sessions.
Only members of the
db_owner or replmonitor fixed database role on the distribution database at the Distributor or on the subscription database at the Subscriber can execute sp_replmonitorhelpmergesession.
( 1500 characters remaining)
Thank you for your feedback