Transaction Log not deleted after Logshipping

jjimjjim Posts: 5
edited March 24, 2006 12:27PM in SQL Backup Previous Versions
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

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hi Jim,

    Here is the gotcha: you also need to specify FILEOPTIONS=1 to delete the old files from the MOVETO location.
  • Thank you for the quick reply, Brian.

    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
  • I had this same problem. petey sent me version 4.2.0.318 which solved the problem.

    It seemed to be caused by the primary DB name differing from the restore DB name...
  • Thank you Jeff for the valuable info.

    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.
  • peteypetey Posts: 2,358 New member
    We are finalizing another fix with regards to license registration, and will inform you when we release the patch version which includes the fix for the ERASEFILES issue.
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • Thank you Peter/Brain. I am looking forward to receiving this patch version soon.

    Jim
This discussion has been closed.