Contents
Why is my database backup plan not deleting old files?
If the database backup maintenance plan involves multiple databases, it is possible that some old backup files might not be deleted as expected. For example, the “Back Up Database Task” includes two databases ABC and XYZ and the “Maintenance Cleanup Task” is set to delete the files older than 1 day.
How to back up database in maintenance plan?
Options in the Back Up Database Task for Maintenance Plan. Use the Back Up Database Task dialog to add a backup task to the maintenance plan. Backing up the database is important in case of system or hardware failure (or user errors) that cause the database to be damaged in some way, thus requiring a backed-up copy to be restored.
How to create maintenance plan for SQL Server?
Generate a maintenance plan that runs maintenance tasks against only those databases that are selected. At least one database in the list must be selected if this option is chosen. Shows the type of backup to be performed. Select Database to back up the entire database. Select File and filegroups to back up only a portion of the database.
What to do if your maintenance plan is not deleting files?
I open up the Plan that seems to have NOT deleted files, copy the xp_delete_file T-SQL statement as generated in the Cleanup task, and run that in SSMS. Result: Files older than three days do in fact get deleted. Conclusion: The task is configured properly.
How to remove old backups from SQL Server?
Remove old SQL backups Open up SQL Server Management Studio In the Object Explorer pane, expand Management Right-click Maintenance Plans Select Maintenance Plan Wizard When prompted, provide a meaningful Name and Description for your plan If you would like this plan to run on a regular schedule,
When to delete a backup from a maintenance plan?
For my production databases, the setting for the Task is summarized as : * Delete based on age: 10 days. That all works fine. * Delete based on age: 3 days. Both Maintenance plans do fine taking the actual backups. The Cleanup of PROD backups seems to do just fine. I don’t have files older than 10 days.
How to determine a SQL Backup retention policy?
You should consider space needed and acceptable losses when determining a SQL backup retention policy. When prompted, provide a meaningful Name and Description for your plan If you would like this plan to run on a regular schedule, rather than On Demand, click Change to specify when the plan should run