May 22, 2005 at 2:46 am
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
May 22, 2005 at 9:38 am
Look up sp_dropdevice in BOL...
**ASCII stupid question, get a stupid ANSI !!!**
May 23, 2005 at 12:56 am
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
May 23, 2005 at 6:35 am
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 !!!**
May 24, 2005 at 2:22 am
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
May 24, 2005 at 12:11 pm
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
May 25, 2005 at 1:14 am
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