Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2003
    Posts
    93

    Unanswered: remove old backup and tran logs thru maintenance plan cleanup task in SQL 2005 SP2

    Has anyone been able to successfully delete old backup files(*.bak) and tran logs (*.trn) TOGETHER using maintenance plan cleanup task in SQL 2005 SP2.

    this is transact sql running in the back ground.
    EXECUTE master.dbo.xp_delete_file 0,N'F:\MSSQL.2\MSSQL\Backup\ibmdir',N'"bak" & "trn"',N'2007-03-26T22:21:14',1

    This DOESNT WORK.

    It works if I just try to delete only one of the things ie trn or bak files.

    EXECUTE master.dbo.xp_delete_file 0,N'F:\MSSQL.2\MSSQL\Backup\ibmdir',N'bak',N'2007-03-26T22:21:14',1

    But is there a way to delete both bak and trn files using one task ?
    Last edited by mgupta; 03-27-07 at 16:40. Reason: didnt put SQL version

  2. #2
    Join Date
    Oct 2003
    Posts
    93
    anybody with comments on this ?

  3. #3
    Join Date
    Dec 2002
    Posts
    1,245
    Quote Originally Posted by mgupta
    anybody with comments on this ?
    I think that they (M$) changed the logic here. It's looking for a specific file extension and not just a date/time range. In other words, I don't think you can do what you are trying to do.

    At least not from my own experience.

    Regards,

    hmscott
    Have you hugged your backup today?

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Why is it so important to use one task? Use two, and chain them together.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  5. #5
    Join Date
    Aug 2008
    Posts
    2
    I have created two tasks, one for deleting .bak files and other for deleting .trn files, and they are chained together and suppose to run after the database backup job. However, these tasks don't run automatically. What could be the reason?

    Thanks.
    Shripad

  6. #6
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Are they set to run on Success, Completion, or Failure of the previous tasks?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •