Transaction Log not deleted after Logshipping
jjim
Posts: 5
I setup logshipping from one server to another, tran log restored successfully on 2nd server, after that, tran logs are moved to "Done" folder by "MOVETO" command. I also have ERASEFILES = 6h, this supposed to delete the files older than 6 hours in "Done" folder. But this never happened. Now I have to go back to the folder regularly to manually delete log files, or the hard drive will be filled up. I have learned from this Forum that this is a bug in SQL Backup. Can anyone help me fixing this "bug" ? ( I have checked the folder "Done", the service account has all the rights to access the folder)
Thanks,
Jim
Thanks,
Jim
This discussion has been closed.
Comments
Here is the gotcha: you also need to specify FILEOPTIONS=1 to delete the old files from the MOVETO location.
But I did have the FILEOPTIONS=1 inside the code, the Log files in "Done" folder are not deleted:
DECLARE @exitcode int
DECLARE @sqlerrorcode int
exec master..sqlbackup N'-sql "RESTORE LOG [ECOM_REP] FROM DISK = ''E:\Microsoft SQL Server\MSSQL\BACKUP\LogShipping\ECOM_REP_Logs\LOG__ECOM_REP_*.sqb'' WITH NORECOVERY, ERASEFILES = 6h, FILEOPTIONS = 1, PASSWORD = ''trvel'', MOVETO = ''E:\Microsoft SQL Server\MSSQL\BACKUP\LogShipping\ECOM_REP_Logs\Done''"', @exitcode OUTPUT, @sqlerrorcode OUTPUT
IF (@exitcode <>0) OR (@sqlerrorcode <> 0)
BEGIN
RAISERROR ('SQL Backup job failed with exitcode: %d SQL error code: %d', 16, 1, @exitcode, @sqlerrorcode)
END
It seemed to be caused by the primary DB name differing from the restore DB name...
We have version 4.1.0.207 and this problem has caused me some headaches.
Can Brian or Petey send me version 4.2.0.318 ? We just bought 10 Server licenses 2 weeks ago.
SQL Backup Consultant Developer
Associate, Yohz Software
Beyond compression - SQL Backup goodies under the hood, updated for version 8
Jim