Warning Deleting Old Files
appwright
Posts: 62
I have been talking with you via support email however repsonse has been sporadic. I am getting errors now even when the backup utility is trying to delete the old backups on the local hard drive. Here is my error log:
4/27/2005 11:03:24 PM: SQL Backup 3.1.0, (c) Red Gate Software Ltd 2004-2005
4/27/2005 11:03:24 PM:
4/27/2005 11:03:24 PM: Backing up TFI (full database) to
\@Backups\PROD01_TFI_db_(full)_200504272303.sqb ...
4/27/2005 11:03:24 PM:
4/27/2005 11:03:24 PM: BACKUP DATABASE [TFI] TO DISK =
'D:\@Backups\PROD01_TFI_db_(full)_200504272303.sqb' WITH NAME =
'Database
(TFI) Full', DESCRIPTION = '', PASSWORD = 'XXXXXXXXXX', ERASEFILES = 1,
MAILTO = 'xxx', COMPRESSION = 3
4/27/2005 11:03:24 PM:
4/27/2005 11:03:24 PM: osql -S AWIPROD_01 -Q "BACKUP DATABASE [TFI] TO
VIRTUAL_DEVICE = 'SQLBACKUP_71519341' WITH BLOCKSIZE = 65536,
MAXTRANSFERSIZE = 1048576, NAME = 'Database (TFI) Full', DESCRIPTION = '', FORMAT" -b -w 120 -U sa -P XXXXXXXXXX
4/27/2005 11:03:25 PM: Backup data size : 20.063 MB
4/27/2005 11:03:25 PM: Compressed data size: 3.871 MB
4/27/2005 11:03:25 PM: Compression rate : 80.71%
4/27/2005 11:03:27 PM: Process completed successfully.
4/27/2005 11:03:27 PM:
4/27/2005 11:03:27 PM: Deleting old backup file: \@Backups\PROD01_TFI_db_(full)_200504261026.sqb
4/27/2005 11:03:27 PM: Warning 161: ERASEFILES error: Failed to delete file: \@Backups\PROD01_TFI_db_(full)_200504261026.sqb. Error code: 158 (The segment is already unlocked).
4/27/2005 11:03:24 PM: SQL Backup 3.1.0, (c) Red Gate Software Ltd 2004-2005
4/27/2005 11:03:24 PM:
4/27/2005 11:03:24 PM: Backing up TFI (full database) to
\@Backups\PROD01_TFI_db_(full)_200504272303.sqb ...
4/27/2005 11:03:24 PM:
4/27/2005 11:03:24 PM: BACKUP DATABASE [TFI] TO DISK =
'D:\@Backups\PROD01_TFI_db_(full)_200504272303.sqb' WITH NAME =
'Database
(TFI) Full', DESCRIPTION = '', PASSWORD = 'XXXXXXXXXX', ERASEFILES = 1,
MAILTO = 'xxx', COMPRESSION = 3
4/27/2005 11:03:24 PM:
4/27/2005 11:03:24 PM: osql -S AWIPROD_01 -Q "BACKUP DATABASE [TFI] TO
VIRTUAL_DEVICE = 'SQLBACKUP_71519341' WITH BLOCKSIZE = 65536,
MAXTRANSFERSIZE = 1048576, NAME = 'Database (TFI) Full', DESCRIPTION = '', FORMAT" -b -w 120 -U sa -P XXXXXXXXXX
4/27/2005 11:03:25 PM: Backup data size : 20.063 MB
4/27/2005 11:03:25 PM: Compressed data size: 3.871 MB
4/27/2005 11:03:25 PM: Compression rate : 80.71%
4/27/2005 11:03:27 PM: Process completed successfully.
4/27/2005 11:03:27 PM:
4/27/2005 11:03:27 PM: Deleting old backup file: \@Backups\PROD01_TFI_db_(full)_200504261026.sqb
4/27/2005 11:03:27 PM: Warning 161: ERASEFILES error: Failed to delete file: \@Backups\PROD01_TFI_db_(full)_200504261026.sqb. Error code: 158 (The segment is already unlocked).
Comments
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8
Nope - nothing would be touching those files. It happens when I run it from the command line also.
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8
Here is the warning on it:
5/5/2005 10:06:31 PM: SQL Backup 3.1.0, (c) Red Gate Software Ltd 2004 - 2005
5/5/2005 10:06:31 PM:
5/5/2005 10:06:31 PM: Backing up DEV2 (full database) on TAHOE instance to \Backups\TAHOE_DEV2_db_(full)_200505052206.sqb ...
5/5/2005 10:06:31 PM:
5/5/2005 10:06:31 PM: BACKUP DATABASE [DEV2] TO DISK = 'D:\Backups\TAHOE_DEV2_db_(full)_200505052206.sqb' WITH NAME = 'Database (DEV2) Full 200505052206', DESCRIPTION = '', INIT, PASSWORD = 'XXXXXXXXXX', ERASEFILES_ATSTART = 2, MAILTO = 'porter@2morrow.com', COMPRESSION = 3
5/5/2005 10:06:31 PM:
5/5/2005 10:06:31 PM: Deleting old backup file: \Backups\TAHOE_DEV2_db_(full)_200505022206.sqb
5/5/2005 10:06:31 PM: Warning 161: ERASEFILES error: Failed to delete file: \Backups\TAHOE_DEV2_db_(full)_200505022206.sqb. Error code: 158 (The segment is already unlocked).
5/5/2005 10:06:32 PM: osql -S TAHOE\TAHOE -Q "BACKUP DATABASE [DEV2] TO VIRTUAL_DEVICE = 'SQLBACKUP_207628493' WITH BLOCKSIZE = 65536, MAXTRANSFERSIZE = 1048576, NAME = 'Database (DEV2) Full 200505052206', DESCRIPTION = '', FORMAT" -b -w 120 -U sa -P XXXXXXXXXX
5/5/2005 10:06:35 PM: Backup data size : 25.500 MB
5/5/2005 10:06:35 PM: Compressed data size: 7.024 MB
5/5/2005 10:06:35 PM: Compression rate : 72.45%
5/5/2005 10:06:38 PM: Process completed successfully.
5/5/2005 10:06:38 PM:
There are a few more attributes than read-only and hidden. I think that Peter's concerned because there is some code in SQL Backup that checks all of these attributes because you can tell the ERASEFILES option not to erase files with a certain attribute set. I've written a bit of script that can help. If you copy and paste this script into notepad, then save it to a file and run it, it will report all of the attributes set on a file:
cscript fileattrs.js /file:<name of file>
Here is the code:
\Backups>cscript fileattrib.js /file:TAHOE_DEV2_db_(full)_200505032206.sqb
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
attributes of TAHOE_DEV2_db_(full)_200505032206.sqb
Archive
I noticed that it is actually deleting older files, however it is saying it is not. Any ideas?
In 3.2, a check is actually made if the physical file exists, before a warning is raised.
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8
I also noticed that even if I have the deletion set for 1, I will still end up with 2 files in holding instead of just the current backup.
Check the timestamp of the two files. SQB will only delete the older file if it is >= 24 hours older than the timestamp of the current backup file.
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8