ERASEFILES_ATSTART question
Randy Doub
Posts: 26
Where does ERASEFILES_ATSTART get it's source from? The backup command that's running or the Server Options defined in the GUI? Or somewhere else?
I have a server where, due to the size of the files, I put the local backups in several different drives/folders. I changed my backup command from ERASEFILE=23h to ERASEFILES_ATSTART=23h expecting yesterday's local copy to be deleted prior to starting today's backup. But nothing on the local drive was deleted, only the remote.
Some time ago I changed the Backup command for this db to backup to local drive U:\sql_backup. In Server Options, Backup Folder still = T:\backup. Due to the size of the backup files, I can't have two files in the U:\sql_backup folder.
Here's a condensed copy of the log:
SQL Backup log file 7.1.0.72
-SQL "BACKUP DATABASE [SMSPHdsshak0] TO DISK = 'u:\sql_backup\<DATETIME mmm_dd_yyyy>_<DATABASE>_<TYPE>.sqb' WITH
COPYTO = '\\myhouse.org\dfsmis\sqlback02\Warehouse63\', COMPRESSION = 3, ERASEFILES_ATSTART = 23h, ERASEFILES_REMOTE = 30,
FILEOPTIONS = 1, MAILTO_ONERROR = 'r.doub@myhouse.org' "
PROCESSES COMPLETED SUCCESSFULLY
10/1/2012 8:00:00 PM: Backing up SMSPHdsshak0 (full database) to:
10/1/2012 8:00:00 PM: u:\sql_backup\Oct_01_2012_SMSPHdsshak0_FULL.sqb
10/1/2012 8:00:00 PM: Deleting old backup file: \\myhouse.org\dfsmis\sqlback02\Warehouse63\Aug_31_2012_SMSPHdsshak0_FULL.sqb
10/1/2012 8:00:00 PM: BACKUP DATABASE [SMSPHdsshak0] TO VIRTUAL_DEVICE = 'SQLBACKUP_F1953AAA-55BF-41B1-9349-39A73C75B0D3' WITH BUFFERCOUNT = 6, BLOCKSIZE = 65536, MAXTRANSFERSIZE = 1048576, NAME = N'Database (SMSPHdsshak0), 10/1/2012 8:00:00 PM',
DESCRIPTION = N'Backup on 10/1/2012 8:00:00 PM Server: SQLDSS002 Database: SMSPHdsshak0', FORMAT
10/1/2012 9:18:24 PM: Database size : 469.776 GB
10/1/2012 9:18:24 PM: Compressed data size: 45.109 GB
10/1/2012 9:18:24 PM: Compression rate : 90.40%
10/1/2012 9:18:24 PM: Processed 20960 pages for database 'SMSPHdsshak0', file 'Primary_FG01_1' on file 1.
10/1/2012 9:18:24 PM: Processed 1006344 pages for database 'SMSPHdsshak0', file 'user_default_fg01_1' on file 1.
10/1/2012 9:18:24 PM: Processed 1011440 pages for database 'SMSPHdsshak0', file 'user_default_fg01_2' on file 1.
.
.
.
10/1/2012 9:18:24 PM: Processed 323472 pages for database 'SMSPHdsshak0', file 'smssr_data_fg02_1' on file 1.
10/1/2012 9:18:24 PM: Processed 322888 pages for database 'SMSPHdsshak0', file 'smssr_data_fg02_2' on file 1.
10/1/2012 9:18:24 PM: Processed 583 pages for database 'SMSPHdsshak0', file 'TransactionLog_1' on file 1.
10/1/2012 9:18:24 PM: BACKUP DATABASE successfully processed 38614911 pages in 4701.432 seconds (64.167 MB/sec).
10/1/2012 9:27:18 PM: Copied u:\sql_backup\Oct_01_2012_SMSPHdsshak0_FULL.sqb to \\myhouse.org\dfsmis\sqlback02\Warehouse63\Oct_01_2012_SMSPHdsshak0_FULL.sqb.
10/1/2012 9:27:18 PM: SQL Backup process ended.
10/1/2012 9:27:18 PM: Deleted msdb entries older than 7/3/2012 9:27:18 PM
10/1/2012 9:27:19 PM: Deleted local history entries older than 7/3/2012 9:27:18 PM
I have a server where, due to the size of the files, I put the local backups in several different drives/folders. I changed my backup command from ERASEFILE=23h to ERASEFILES_ATSTART=23h expecting yesterday's local copy to be deleted prior to starting today's backup. But nothing on the local drive was deleted, only the remote.
Some time ago I changed the Backup command for this db to backup to local drive U:\sql_backup. In Server Options, Backup Folder still = T:\backup. Due to the size of the backup files, I can't have two files in the U:\sql_backup folder.
Here's a condensed copy of the log:
SQL Backup log file 7.1.0.72
-SQL "BACKUP DATABASE [SMSPHdsshak0] TO DISK = 'u:\sql_backup\<DATETIME mmm_dd_yyyy>_<DATABASE>_<TYPE>.sqb' WITH
COPYTO = '\\myhouse.org\dfsmis\sqlback02\Warehouse63\', COMPRESSION = 3, ERASEFILES_ATSTART = 23h, ERASEFILES_REMOTE = 30,
FILEOPTIONS = 1, MAILTO_ONERROR = 'r.doub@myhouse.org' "
PROCESSES COMPLETED SUCCESSFULLY
10/1/2012 8:00:00 PM: Backing up SMSPHdsshak0 (full database) to:
10/1/2012 8:00:00 PM: u:\sql_backup\Oct_01_2012_SMSPHdsshak0_FULL.sqb
10/1/2012 8:00:00 PM: Deleting old backup file: \\myhouse.org\dfsmis\sqlback02\Warehouse63\Aug_31_2012_SMSPHdsshak0_FULL.sqb
10/1/2012 8:00:00 PM: BACKUP DATABASE [SMSPHdsshak0] TO VIRTUAL_DEVICE = 'SQLBACKUP_F1953AAA-55BF-41B1-9349-39A73C75B0D3' WITH BUFFERCOUNT = 6, BLOCKSIZE = 65536, MAXTRANSFERSIZE = 1048576, NAME = N'Database (SMSPHdsshak0), 10/1/2012 8:00:00 PM',
DESCRIPTION = N'Backup on 10/1/2012 8:00:00 PM Server: SQLDSS002 Database: SMSPHdsshak0', FORMAT
10/1/2012 9:18:24 PM: Database size : 469.776 GB
10/1/2012 9:18:24 PM: Compressed data size: 45.109 GB
10/1/2012 9:18:24 PM: Compression rate : 90.40%
10/1/2012 9:18:24 PM: Processed 20960 pages for database 'SMSPHdsshak0', file 'Primary_FG01_1' on file 1.
10/1/2012 9:18:24 PM: Processed 1006344 pages for database 'SMSPHdsshak0', file 'user_default_fg01_1' on file 1.
10/1/2012 9:18:24 PM: Processed 1011440 pages for database 'SMSPHdsshak0', file 'user_default_fg01_2' on file 1.
.
.
.
10/1/2012 9:18:24 PM: Processed 323472 pages for database 'SMSPHdsshak0', file 'smssr_data_fg02_1' on file 1.
10/1/2012 9:18:24 PM: Processed 322888 pages for database 'SMSPHdsshak0', file 'smssr_data_fg02_2' on file 1.
10/1/2012 9:18:24 PM: Processed 583 pages for database 'SMSPHdsshak0', file 'TransactionLog_1' on file 1.
10/1/2012 9:18:24 PM: BACKUP DATABASE successfully processed 38614911 pages in 4701.432 seconds (64.167 MB/sec).
10/1/2012 9:27:18 PM: Copied u:\sql_backup\Oct_01_2012_SMSPHdsshak0_FULL.sqb to \\myhouse.org\dfsmis\sqlback02\Warehouse63\Oct_01_2012_SMSPHdsshak0_FULL.sqb.
10/1/2012 9:27:18 PM: SQL Backup process ended.
10/1/2012 9:27:18 PM: Deleted msdb entries older than 7/3/2012 9:27:18 PM
10/1/2012 9:27:19 PM: Deleted local history entries older than 7/3/2012 9:27:18 PM
Comments
Looking at the log you posted, it looks like your backups take about 1.5 hrs to complete. In this case, you would need to use an ERASEFILES_ATSTART value of 22h.
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8