Attempts to restore a SQL Server database with the ESE Agent fails with the following error:
ERROR : 10:49:26 Could not prepare for restore of VSS writer 'SqlServerWriter' (0x800423f4; writer error (not retryable), please check the event log for related events from the application hosting the VSS writer). [Writer details: 4ebc5ea8-a65f-aa63-2a91-26dbc4a0bd9d;452ebadc-f913-2554-1614-ba4e0145eaa7;failed at pre restore]
When viewing the Windows Event Log, additional information can be seen:
After renaming a database, the file names on disk remain unchanged. When an attempt is made to restore these files, the process fails because they are in use by the renamed SQL Server database.
We suggest one of two options:
- To overwrite the database files, the renamed database will need to be detached from the SQL Server before restoring the backed-up copy.
- Alternatively, restore the database files to a different location.
In both cases, you can re-attach the files afterwards by using the original database name and then renaming it again.