Sql-server – SQL Server replication pending transactions

replicationsql server

I'm having a problem with a transactional replication. I have the publisher in my server and there is a subscriber in another server.

In my server, if I go to the details of the subscription I can see that there is 1 undistributed command, but if I execute 'exec sp_repltrans' there's no results…, it's this possible or I have an error? this server recently crashes and I don't know if the replication were replicating data when the server crash.

I try to make some changes in the tables, to see what happens with the undistribute commands counter, and it increments with the change (show 2 commands), takes longer than usual in replicate (before it replicates instantly), but finally the counter back to 1.

Is there any other way to get that pending transaction?

— EDIT 1 —

Thanks Brandon, the result for this was interesting, with sp_browsereplcmds I found the pending command.

The interesting thing it's that the pending command correspond with my last test change, and if I make another change to a table to see what happens, I have again 2 undistributed commands and when some minutes past then the previous command it's replicated to the subscriber and the new last command keep in the undistributed commands..

Opening every window of the publisher and looking for more information, I found in the "queue reader agent" this error:
The replication agent has not logged a progress message in 10 minutes. This might indicate an unresponsive agent or high system activity. Verify that records are being replicated to the destination and that connections to the Subscriber, Publisher, and Distributor are still active.

  • Can be a problem in the subscriber and not in the publisher?.
  • This last thing (The replication agent has not logged a progress message in 10 minutes…) be part of the problem that I'm having with the 1 undistributed command?

Best Answer

sp_repltrans returns transactions in the publication transaction log that are marked for replication but have not been marked as distributed. Basically, sp_repltrans shows the transactions that have not been moved to the distribution database yet. This is different than the Undistributed Commands tab in Replication Monitor which displays information about commands in the distribution database that have not been delivered to the selected Subscribers.

Use sp_browsereplcmds to locate the undistributed command.