Problem description
SQL backup fails with SQL backup failed: Vss Error: Operation timedout of gathering writer metadata
Cause
This issue can occur if the registry Volume Shadow Copy Service (VSS) writer did not respond to a query from the VSS service (OS level operation).
Traceback
Log location: C:\ProgramData\Phoenix\FS\Phoenix.log
[ERROR] <_MainThread(MainThread)> SqlAgent :SQL backup failed: Vss Error: Operation timedout of gathering writer metadata hr = -2147212520[2020-01-15 00:11:52,312] [ERROR] <_MainThread(MainThread)> Error <class 'pyvss.VssException'>:Vss Error: Operation timedout of gathering writer metadata hr = -2147212520. Traceback -Traceback (most recent call last): File "agentPartnerProcess.pyc", line 84, in _process_request_start File "agents\sqlserver\SqlAgent.pyc", line 60, in process_backup_start File "agents\sqlserver\SqlBackup.pyc", line 54, in init File "agents\sqlserver\SqlBackup.pyc", line 110, in __init_helpers File "agents\sqlserver\VssHelper.pyc", line 1288, in get_backup_helper_object File "agents\sqlserver\VssHelper.pyc", line 144, in __init__ File "agents\sqlserver\VssHelper.pyc", line 107, in get_current_server_info File "agents\sqlserver\sql_vss_2.pyc", line 405, in discover_databases File "roboClientLib\vssutils.pyc", line 195, in gather_writer_metadataVssException: Vss Error: Operation timedout of gathering writer metadata hr = -2147212520
Event viewer:
Event ID 12347 — Volume Shadow Copy Service OperationsVolume Shadow Copy Service error: An internal inconsistency was detected in trying to contact shadow copy service writers. The Registry Writer failed to respond to a query from VSS. Check to see that the Event Service and Volume Shadow Copy Service are operating properly, and please check the Application event log for any other events.
Resolution
Run the following command in the command prompt to check the writer status and ensure it is in a stable state:
vssadmin list writers
The Registry writer status must be as follows
Writer name: 'Registry Writer'
Writer Id: {xxxxxxxxxxxxxxxxxx}
Writer Instance Id: {xxxxxxxxxxxxxxxxxx}
State: [1] Stable
Last error: No errorFor further guidance, refer to the Microsoft article: Event ID 12347 — Volume Shadow Copy Service Operations.
Rebooting the server may also resolve the issue.
Fore more detail information, follow the instruction provided in the article SQL Server backup failed due to VSS error: State: Waiting for completion