What are the challenges you face when working across database platforms? Take the survey
Options

Problem with erasing old backup files

Markus BohseMarkus Bohse Posts: 3
edited June 19, 2008 3:48AM in SQL Backup Previous Versions
Hello everybody,
I'm using SQL Backup vers 5.3.0.178. From inside a stored procedure I call sqlbackup to make backup, copy to network share, remove local files older than 1 day and remove rmote files older than 1 day. While the remote files are deleted succefully the local files don't. I tried playing around with the FILEOPTIONS parameter but so far without success.
Here's my statement:
EXEC master..sqlbackup -SQL "BACKUP DATABASES [model]
TO DISK = 'E:\\MSSQL\BACKUP\\model\<AUTO>'
WITH NAME = '<AUTO>',
DESCRIPTION = '<AUTO>',
COMPRESSION = 2,
COPYTO = '\\Server1\Backups$\model',
ERASEFILES_REMOTE = 1,
ERASEFILES = 1,
FILEOPTIONS = 3,
THREADS = 1"
Any idea how I can get this to work ?
Thanks in advance
Markus

Comments

  • Options
    peteypetey Posts: 2,358 New member
    Do the files that were not deleted have the archive attribute set? If so, they will not be deleted as you used FILEOPTIONS = 3. If you want the files to be deleted regardless of the archive attribute value, use FILEOPTIONS = 1.
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • Options
    Yes, the files have the archive attribute set. I will give it a try using Fileoption1.

    Thanks Markus
Sign In or Register to comment.