Skip to content

Read Commands from Distribution Database

How to use sp_browsereplcmds on the distribution database to inspect pending replication commands when diagnosing agent errors.

Published Oct 11, 2008

When a distribution agent fails, the fastest way to see exactly what command it was trying to apply is sp_browsereplcmds, run on the distribution database. It lists the commands sitting in the distribution database and accepts parameters that let you narrow the results - most usefully the LSN range from the agent's error log, plus originator id, publisher database id, article id, command id and agent id. The full parameter list is included in the script.

--This procedure can be used to read the commands which are in the distribution
--	database and can be passed parameters to aid in the resolution of
--	distribution agent errors (such as the LSN from the agent logs).
sp_browsereplcmds

/*
sp_browsereplcmds [ [ @xact_seqno_start = ] 'xact_seqno_start' ]
    [ , [ @xact_seqno_end = ] 'xact_seqno_end' ] 
    [ , [ @originator_id = ] 'originator_id' ]
    [ , [ @publisher_database_id = ] 'publisher_database_id' ]
    [ , [ @article_id= ] article_id ]
    [ , [ @agent_id = ] agent_id ]
    [ , [ @compatibility_level = ] compatibility_level ]
*/
An unhandled error has occurred. Reload 🗙