We log ship several DBs from primary to secondary server. Looking at mdb.dbo.log_shipping_monitor_error_detail on secondary server.

Seeing this error pattern over and over many times a day..

Record 1 : Could not copy log backup file '\\SQLSERVER\LogShip\FOO\FOO_20201126153001.trn'. The copy operation will be re-attempted on the next run of the Copy job.

Record 2 : The process cannot access the file '\\SQLServer\LogShip\FOO\FOO_20201126153001.trn' because it is being used by another process.

Is this error simply caused because the tran file is still open at the time of the attempted log copy operation? Is this expected behavior for log shipping secondary copy operation?

  • 1
    what are the start times of your backup and copy jobs? if they start at the same time then it is possible the backup has not completed, before the copy starts. I stagger my backup, copy, and restore jobs.
    – Bob Klimes
    Nov 26 '20 at 15:54
  • Backup on primary runs every 3 minutes. Copy & Restore on secondary appear to run every 15 minutes. Nov 26 '20 at 16:19
  • 1
    May be AV scanning the fileshare and have taken lock
    – Shanky
    Nov 26 '20 at 17:07
  • 1
    for the times that you received the errors, did the backup and copy run at the same time? ie backup and copy start at 12:00. if so, you could just adjust your copy job to start at 12:01, and restore job at 12:02. AV is also a possibility as @Shanky said
    – Bob Klimes
    Nov 26 '20 at 17:20
  • Looks like backup job on primary and copy job on secondary ran at same times. Interestingly both agent jobs show success even though msdb.dbo.dbo.log_shipping_monitor_error_detail shows the file in use error. I guess log_shipping_monitor_error_detail will show transitory errors as well? Nov 26 '20 at 17:37

Found a post discussing how to address this issue :

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.