ERASEFILES_ATSTART fails to delete all backup files
stratburst
Posts: 7
I am performing transaction log file backups via a scheduled stored procedure job utilizing ERASEFILES_ATSTART. The job successfully backs up all logs but fails to erase all of the transaction log backup files as configured. All databases configured with full recovery model. No error seem to be logged. The following is a snippit of the SP that sets the log backup parameters. Please advise.
set @backupstring = '-SQL "BACKUP LOG TO DISK = ''' + @filename + ''' WITH NAME = ''Database (' + @databasename + ')'', VERIFY, ERASEFILES_ATSTART = 1, MAILTO_ONERROR = ''xxx@xxxx.com'', COMPRESSION = 1" -E'
set @backupstring = '-SQL "BACKUP LOG TO DISK = ''' + @filename + ''' WITH NAME = ''Database (' + @databasename + ')'', VERIFY, ERASEFILES_ATSTART = 1, MAILTO_ONERROR = ''xxx@xxxx.com'', COMPRESSION = 1" -E'
This discussion has been closed.
Comments
The ERASEFILES_ATSTART and ERASEFILES options value is number of days. This is calculated as 24 hour blocks, so the only files deleted will be greater than X*24 hours old.
In your script all the files that remained should be less than 24 hours old.
Regards
Dan
Red Gate Software Ltd
Any known issues with long file names? This might be entirely irrelevant but it seems that the backup files that are not being deleted are 20+ char long. Doesn't seem to be a 15+1 char issue as several of the databases are longer that 16 char but less than 20.
We have had no reports of long file name problems. Can you check that the SQLAgent user has adequate rights to delete files from the directory, and that you are running version 3.2 .
Regards
Dan
Red Gate Software Ltd
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8
This will be fixed in a future release. If you need this to work now on English operating systems, you can do the following, but note that this is an unofficial, unsupported workaround and has not been fully tested:
Using a hex editor, look for the following sequence in sqlbackup.exe and sqlbackupc.exe:
B916000000BA01000000
Change the value 16 (hex for 22) to 2C (hex for 44). You should find two occurences of this sequence. The first is for the instance name, and the second for the database name. Making both changes will then store the first 44 characters of the instance/database name in the SQL Backup file header block.
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8
Sorry, but we haven't released a new version since the last post on 19 June. I'm sure that the fix will be included in the next release.
In version 4, the full name of the database (max 128 characters) will be stored as a unicode string.
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8