Distribution clean up job ran without errors according to schedule, but I noticed that the snapshot files were not removed even if when created beyond max_disretention period. Records from msrepl_commands and msrepl_transactions were removed, but the files were not.

  • immediate_sync = 1
  • max_disretention = 72 hours
  • 1
    This sounds like a permission issue. Have you granted the service accounts (SQL Engine and Agent on the distribution server) full access to the directory where the replication files live? – nkdbajoe Aug 28 '16 at 18:47

the "immediate sync" option is the problem here. Unless you are regularly adding new subscribers every few hours, then this can be set to false and the snapshots are then cleared out after being applied.

exec sp_changepublication
          @publication=N'<publication_name>',
          @property=N'allow_anonymous',
          @value='false';
go

exec sp_changepublication
          @publication=N'<publication_name>',
          @property=N'immediate_sync',
          @value='false';
go

There is a lot of really good information about this here: http://www.replicationanswers.com/TransactionalOptimisation.asp

  • Tried this with no luck. I suspect records from Msrepl_commands somehow removed without touching files, after that those files keep forever. – Eldar Feb 6 '15 at 8:01

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.