Sql-server – SQL Server Snapshot Replication – Is there an option to clean up the snapshot folder after X amount of time

replicationsql server

We're running snapshots from a 2016 to a 2019 SQL Server.

I've looked through Microsoft's documentation and I'm not seeing a clear cut way to have this, and I'm not seeing any jobs on the Publisher/Subscriber that would run this sort of cleanup.

We recently had a drive fill up and I want to make sure to get this sorted out if it's a native feature of replication, otherwise I'm going to run a PowerShell script to take care of it.

Best Answer

set the retention period on the publication also see the link below ( this is the replication escalation engineers blog site - so a great resource ) for a slight gotcha.

https://repltalk.com/2010/07/14/snapshot-files-deleted-when-immediate_sync-ntrue-and-retention-0/