Veeam: File is locked by running session

I seem to have come across this issue quite often recently, where Veeam reports “File is locked by running session (Name of Current Job)”

I have found that more often than not, the issue is caused when a job is stopped incorrectly, for example the Veeam server is rebooted during a backup job. In this example the SQL database has insufficient time to shutdown the job cleanly and requires some administrative intervention to clean the database.

Its a simple job that requires opening SQL Server Management Studio and connecting to the Veeam database, then running a small query to clear a number of entry’s.

Run the following SQL Query against the Veeam Database:

delete from [Backup.TrackedActions.Leases]
delete from [Backup.TrackedActions.LockItems]
delete from [Backup.TrackedActions.Locks]

NOTE: Make sure no jobs are running before running the query.