Skrevet av Emne: SQL-Server: Maintenance Cleanup Task not deleting files  (Lest 4651 ganger)

ATC

  • Gjest
SQL-Server: Maintenance Cleanup Task not deleting files
« på: 20. April 2009, 15:23 pm »
  • [applaud]0
  • [smite]0
  • When configuring maintenance tasks such as database or transaction log backup, it is customary to include a Cleanup task to delete old backups to prevent the disk from filling up.

    This cleanup task appears to be properly configured, but the files are not deleted and backups are failing because the disk is full.



    ATC

    • Gjest
    [Solved] SQL-Server: Maintenance Cleanup Task not deleting files
    « Svar #1 på: 20. April 2009, 15:23 pm »
  • [applaud]0
  • [smite]0
  • See http://social.msdn.microsoft.com/forums/en-US/sqltools/thread/4bce2ade-a62e-458b-9251-4469228465d7/
    ---
    For other folks who might run across this thread...  I was having this same problem and after a week of researching I have found several possible solutions... I didn't try all of these as I finally found a combination that worked for me.. some of them might not make any sense at all, but after a week I was game to try anything:


    - no "." in front of "bak" or "trn"

    - use a \ at the end of the path (this is the one that got me working)

    - use * for the extension

    - switch between caps & lower case (BAK vs bak vs Bak)

    - switch on first level folders

    - the task checks the files to verify that they are backup files... so empty test files may not work.

    - there are several script options out there...  VBScript, unix utils, & others.

     Hopefully this will help someone save some time and frustration!
    ---

    On another note, I found that since in most cases today's backup has priority over older backups (you ARE backing those files up to tape, yes?) it makes sense to run the Cleanup Task BEFORE the Backup task and not the other way around.

    One server I took over was configured the other way around, which caused the Cleanup Task to never run because the disk was too full for the Backup Task to complete. Fortunately, this was discovered during regular maintenance and not when I needed the backups :-)