deletion from backup device

  • hello all.

    does any one know if there is a way to delete specific backups from backup devices?? And if so what's the script??

    thanks in advance

    chen

  • Look up sp_dropdevice in BOL...







    **ASCII stupid question, get a stupid ANSI !!!**

  • This SP will delete the entire device.... i only want to delete those who are expired from it to conserve space. Is there a script for it or do i do it progrematiclly??

    chen

  • Chen - not sure what you mean when you say "will delete the entire device"! You are going to be specifying name of device to be dropped....alternately, the easier way to do this will be via Enterprise Manager - under the "Management" - "Backup" folder where you can manually select and delete the ones you don't want.

    I also came across this site that has a procedure that deletes devices...maybe you could use some/all of it...

    http://perso.wanadoo.fr/ngx/doc/sqlbhtml/sybsystemprocs_dbo_sp_dropdevice.html







    **ASCII stupid question, get a stupid ANSI !!!**

  • Sorry for the inclarity, i will try to explain :

    in a backup device there are many backups, and i am looking for a script that will delete specific backups from the file without deleting the whole device

    if you know any scripts, i would thank you if you post them

    thanks

    chen

  • Here is the script that I use

    Option Explicit

    'on error resume next

    Dim oFSO

    Dim sDirectoryPath

    Dim oFolder

    Dim oFileCollection

    Dim oFile

    Dim iDaysOld

    'Customize values here to fit your needs

    iDaysOld = 2

    Set oFSO = CreateObject("Scripting.FileSystemObject")

    sDirectoryPath = "Backup Directory Path"

    set oFolder = oFSO.GetFolder(sDirectoryPath)

    set oFileCollection = oFolder.Files

    'Walk through each file in this folder collection.

    'If it is older than 3 weeks (21) days, then delete it.

    For each oFile in oFileCollection

    If oFile.DateLastModified < (Date() - iDaysOld) Then

    oFile.Delete(True)

    End If

    Next

    'Clean up

    Set oFSO = Nothing

    Set oFolder = Nothing

    Set oFileCollection = Nothing

    Set oFile = Nothing

  • Thanks for the reply, but....

    i wanted specific files from backup SETS, not stand alone files, and in TSQL, as i know how to do this in vb

    thnks chen

     

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply