I am desperately looking for some logic or script to check commands in msrepl_commands
where number of commands which have already been moved to subscriber but not deleted yet.
I am running the procedure manually:
EXEC dbo.sp_MSdistribution_cleanup @min_distretention = 0, @max_distretention = 72
but it is not deleting any rows even though I checked msrepl_commands
and found there are 20M rows that all came in between 2016-08-30 00:01:00 AM and 2016-08-31 09:00:00 AM, but if I run distribution cleanup then it should delete top 10K in a loop till the row count reaches 2000.
I am a bit confused how to check those delivered commands (msdistribution_status
gives me dilevered and undilevered commands but that is cumulative, and I need current status).