Comments
4 comments
-
I think you will get more assistance if you provide the code you are currently running.
You can adjust database/server names for confidentiality.
I know we had an issue with this some time back, but in recent versions no problems.
Be sure to pay attention to any TAPE backup that may be picking up(locking) the previously created file.
You should be able to rename the file as a test to see if it is locked. -
Sure, below is the code,
DECLARE @exitcode int
DECLARE @sqlerrorcode int
EXECUTE master..sqlbackup '-SQL "BACKUP DATABASES [DB1,DB2,DB3] TO DISK = ''C:\Backup\Full\<database>\<AUTO>.sqb'' WITH ERASEFILES_ATSTART = 1b, PASSWORD = ''<ENCRYPTEDPASSWORD>xxxxxxxxxxx</ENCRYPTEDPASSWORD>'', CHECKSUM, DISKRETRYINTERVAL = 30, DISKRETRYCOUNT = 10, KEYSIZE = 256, THREADCOUNT = 23"', @exitcode OUT, @sqlerrorcode OUT
IF (@exitcode >= 500) OR (@sqlerrorcode <> 0)
BEGIN
RAISERROR ('SQL Backup failed with exit code: %d SQL error code: %d', 16, 1, @exitcode, @sqlerrorcode)
END
I also double checked and no tape backups are running or did run at the same time. -
We use the erasefiles_atstart option with a value of 40h.
This assumes we are running a daily backup (every 24 hours) and wish to always have at least 1 complete backup available on disk.
If you wish to essentially overwrite the previous backup you can simply set this value to less than your expected backup schedule.
So if you are running a daily backup, tryerasefiles_atstart = 1h
-
Thanks epetro, I thought of something like that too. It's not super clean but it should work for our office.
Add comment
Please sign in to leave a comment.
Thanks