Skip to content

Commit

Permalink
adds error code for drop & retry
Browse files Browse the repository at this point in the history
  • Loading branch information
rducom committed Apr 29, 2021
1 parent c2cef2d commit a0b1275
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/SqlBackupTools/Restore/Native/NativeRestoreMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ private async Task<Exception> InternalFullDiffLogAsync(RestoreItem item, bool st

break;
}
catch (SqlException sqle) when (sqle.Number == 3101)
catch (SqlException sqle)
when (sqle.Number == 3101 || //Exclusive access could not be obtained because the database is in use.
sqle.Number == 3201) // Cannot open backup device.
{
//Exclusive access could not be obtained because the database is in use.

// RESTORE DATABASE is terminating abnormally.
item.StatsDropped++;
_state.Loggger.Debug(sqle, item.Name + " : Error on first attempt, retrying from scratch");
Expand Down

0 comments on commit a0b1275

Please sign in to comment.