Returns the commands for transactions marked for replication in readable format. sp_replshowcmds can be run only when client connections (including the current connection) are not reading replicated transactions from the log.
sp_replshowcmds [@maxtrans =] maxtrans
sp_replshowcmds is a diagnostic procedure that returns information about the publication database from which it is executed.
Column name | Data type | Description |
---|---|---|
xact_seqno | binary(10) | Sequence number of the command |
originator_id | int | ID of the command originator, always 0 |
publisher_database_id | int | ID of the Publisher database, always 0 |
article_id | int | ID of the article |
type | int | Type of command |
command | nvarchar(1024) | Transact-SQL command |
sp_replshowcmds is used in transactional replication.
Using sp_replshowcmds, you can view transactions that currently are not distributed (those transactions remaining in the transaction log that have not been sent to the Distributor).
Clients that run sp_replshowcmds and sp_replcmds within the same database receive error 18752.
To avoid this error, the first client must disconnect or the client’s role as log reader must be released by executing sp_replflush. After all clients have disconnected from the log reader, sp_replshowcmds can be run successfully.
Note sp_replshowcmds should be run only to troubleshoot problems with replication.
Only members of the sysadmin fixed server role or the db_owner fixed database role can execute sp_replshowcmds.
Error Messages | sp_replflush |
sp_replcmds | sp_repltrans |
sp_repldone | System Stored Procedures |