SQL Server Log Shipping – Primary Database Log Backup Job Failing

log-shippingsql serversql-server-2012

We have set up LS to do cutover from standalone SQL server 2012 to clustered 2012 servers.

The primary database where we have set up LS is also involved in database mirroring and is about 1.8 TB in size. This is PERF env to test the actual cutover and transactions are not frequent on database where LS is set up.

Issue: I see that LS backup job on primary runs longer than scheduled [every 15 mins] or fails with below error:

Unhandled Exception: System.IO.FileLoadException: The process cannot
access the file because it is being used by another process.
(Exception from HRESULT: 0x80070020) at


There is no fixed pattern when its failing. generally it completes in 18-20secs but on some runs it fails when running over 50 mins or so.

How can i troubleshoot this further?

Edit: @ Log backups are from 100-200 MB generally every 15 mins

Best Answer

How can i troubleshoot this further?

Since you can't make it happen every time a backup occurs, I'd run procmon and filter against the folder you're sending the log backups. When it occurs, stop the procmon and investigate what applications are taking locks on the file. My guess, though, is going to be antivirus or some other filter driver filesystem watcher. The fact it happens more frequently on larger files is a giveaway.

If you know it's going to fail, or is currently having issues you could use process explorer and search for the file in the handles and see what processes are touching it.

This is happening at the windows/driver level, not the SQL Server application level.