3

The job that I thought was supposed to clean up old snapshots isn't removing the old files. The retention is left at default yet there are snapshots months old which remain. The job runs as the agent account (maybe I should try a proxy account?) and this account has full permissions to the folder.

I have checked sp_configure to ensure xp_cmdshell is enabled and it is.

The cleanup job runs the proc sp_MSsubscription_cleanup, however I can't see anywhere in that which would delete the old snapshot files.

Can anyone enlighten me?
Thanks

1 Answer 1

4

The MSDN Blog "SQL Server SSIS and Replication" has a post from a few years ago. http://blogs.msdn.com/b/mangeshd/archive/2009/05/20/replication-snapshot-folder-cleanup.aspx

How these old snapshot folders are purged depends on the type of replication you are using:

  1. For snapshot and transactional replication: Distribution cleanup agent purges the non-latest folders

  2. For Merge replication: the snapshot agent itself will purge older folders.

Chris Skorlinski, one of the developers on replication, had (from a few years ago) the following to say: "For merge replication, the snapshot agent ... is responsible for cleaning up the last generated snapshot. The snapshot agent will only try once to remove the previous snapshot files so if those files were locked at that moment (by the merge agent e.g.), it is possible that snapshot files will be left over."

He recommends that you check the snapshot agent history to see if errors were reported.

If this is a continuing problem perhaps you could create a PowerShell script to remove the older snapshot folders. And, of course, you can manually delete them, though that is not a useful long-term solution.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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