Challenge
When attempting to backup a SQL server that is hosting a significant amount of databases the following error is thrown:
Unable to release guest. Error: Unfreeze error: [Backup job failed. Cannot create a shadow copy of the volumes containing writer's data. A VSS critical writer has failed. Writer name: [SqlServerWriter]. Class ID: [{}]. Instance ID: [{}]. Writer's state: [VSS_WS_FAILED_AT_PREPARE_SNAPSHOT]. Error code: [0x800423f4].]
Error: Unfreeze error: [Backup job failed. Cannot create a shadow copy of the volumes containing writer's data. A VSS critical writer has failed. Writer name: [SqlServerWriter]. Class ID: [{}]. Instance ID: [{}]. Writer's state: [VSS_WS_FAILED_AT_PREPARE_SNAPSHOT]. Error code: [0x800423f4].]
Cause
Veeam Backup & Replication sends a VSS API request to freeze an entire SQL server including all databases. In SQL Server, the snapshot backup of each database uses five threads in the Sqlservr.exe process. Additionally, other activities may also use threads in the Sqlservr.exe process. Depending on the configuration of SQL Server, the available threads may be used up if you create a snapshot backup of many databases at the same time.
It is possible to process the VM in a crash-consistent manner by disabling Application-Aware Image Processing within the job.
Solution
Microsoft does not recommend creating a snapshot for more than 35 databases at the same time. It is advised to create another SQL Server and move the databases that are causing failure to the other SQL server. Adding additional CPU cores and RAM may also fix the issue.
In certain scenarios changing the max worker threads Server Configuration Option may help negate the issue. However, it is advisable to contact Microsoft support for verifying this step.
For further troubleshooting, Microsoft recommends figuring out which SQL instance has the problem. Usually, the problematic SQL instance will be named in the first recorded SQLVDI error.
Please refer to the following articles for details:
- https://support.microsoft.com/en-us/kb/943471
- http://blogs.msdn.com/b/psssql/archive/2009/03/03/how-it-works-sql-server-vdi-vss-backup-resources.aspx
- https://msdn.microsoft.com/en-us/library/ms190219.aspx?f=255&MSPPError=-2147217396
- https://support.microsoft.com/en-us/kb/2157129
More Information
Note: Veeam Support is not able to provide assistance with modifying the number of threads within SQL. Please contact Microsoft Support for assistance.