пятница, 15 декабря 2023 г.

MSDistribution cleanup

 EXEC dbo.sp_MSdistribution_cleanup @min_distretention = 0, @max_distretention = 24


select count(*) from distribution..msrepl_commands

select count(*) from distribution..msrepl_transactions


go

DECLARE @rowcountCom int = 5000000

DELETE TOP(@rowcountCom) MSrepl_commands WITH (PAGLOCK) 

FROM MSrepl_commands 

WITH (INDEX(ucMSrepl_commands)) 



DELETE TOP(@rowcountCom) MSrepl_commands WITH (PAGLOCK) 

FROM MSrepl_commands 

WITH (INDEX(ucMSrepl_commands)) 



DELETE TOP(@rowcountCom) MSrepl_commands WITH (PAGLOCK) 

FROM MSrepl_commands 

WITH (INDEX(ucMSrepl_commands)) 


go

DELETE TOP(@rowcountCom) MSrepl_commands WITH (PAGLOCK) 

FROM MSrepl_commands 

WITH (INDEX(ucMSrepl_commands))