none
Remove old SQL 2005 Backup files RRS feed

  • Question

  • I am trying to configure a maintenance plan in SQL 2005 to do a full backup every day and to do log file backups every hour.

    What I want to do is to keep 3 days worth of full backups and 24 hours of log backups and remove all the backups older that this from the server so that I do not use all of my disk space. I will then backup these files to tape so that I have a good backup history.

    In SQL 2000 there was a simple option to remove backup files older than a given time frame. Is there an option to do this in 2005? If not can you suggest a way that I can do this.

     

    Thursday, August 17, 2006 2:02 PM

All replies

  • You can delete backup files older than "x" days by adding a maintenance cleanup task to your maintenance plan, this does require that SP1 has been installed. This task needs to be added within the studio (right click your plan and select modify), it is not available in the maintenance plan wizard. You will need to create an additional task to delete your logs every 24 hours, for example:

    http://img.photobucket.com/albums/v472/Schmedrick/mainttask.gif

     

     

    Friday, August 18, 2006 2:00 AM
  • Hi,

    Cleaning option is working for directory but if i have subdirectory structre withing main backup directory for different databses so it will not work. For example  In backup directory i am taking backup for databases 'xyz' in ''xyz' subdirectory like V:\Backup\XYZ  and there is more than one subdirector and i want to delete all old backup files after completion of all backup.So  How can i do this in 2005?

    Tuesday, August 22, 2006 4:41 AM
  • Hi,

    Did you try checking the box to include sub level folders?

     

     

    Tuesday, August 22, 2006 3:40 PM
  • Hey Thanks Andy,

    But i never seen check  box for include sub level folder in maintanance plan clean up task.

    can you tell me where it is exactly ? if possiable send me snapshot..

    Or if you have any alternate method please tell me

     

    Thanks

     

    Thursday, August 24, 2006 6:24 AM
  • Hi there, see the red circle in this snapshot

    http://img.photobucket.com/albums/v472/Schmedrick/mainttask2.gif

     

     

    Friday, August 25, 2006 2:20 AM
  • Thanks Andy,

    I gone throgh u r link but in my SQL Server 2005 editition under 'Maintanance Clean Up Task ' there is no 'Include First Level Folder Option' Check box.

    I have checked out with SQL Server 2005 Enterprise Edition and Standrd Edition But i didn't got this option.

    Whcih SQL server vresion u r using?

    Or u r  taking this fron Bussiness intelligence?

     

    Please let me know..

    Saturday, August 26, 2006 10:14 AM
  • Hi there,

    I am using SQL Server 2005 Enterprise Edition with Service Pack 1. Do you have SP1 installed on your server? I would think so as you have the cleanup task but just wanted to check.

     

     

    Saturday, August 26, 2006 5:19 PM
  • I use FileDestroyer 
    http://sourceforge.net/projects/filedestroyer/

    Here is a short tutorial:

    http://arturito.net/2010/07/13/file-destroyer-clean-upfree-up-disk-space-and-deleting-files-or-folders-after-a-certain-period-of-time/
     

    Usage:
    FileDestroyer.exe -scan “D:\SQLBackup” -ext bak -log “D:\Logs\” –days 2 
    This command scans folder “D:\SQLBackup” looks for extension .bak and removes backups/files older than 2 days and it logs everything in D:\Logs\
    It also supports UNC Paths (\\server1\shared\backups\)
    Tuesday, July 12, 2011 8:43 AM