MSSQL Refresh Fails with Error 'Cannot drop the database while the database snapshot "VMcL_dbss1800" refers to it' (KBA4986)
KBA
KBA# 4986
Issue
In SQL Server 2016 the ability to perform database snapshots was introduced. An application can generate a database snapshot during its deployment. These snapshots can negatively impact Delphix related operations.
When performing a VDB refresh, Delphix will need to drop the database as part of the process. If a database snapshot is present then the following error will be generated:
Error
Failed to delete the virtual database "VMcL_6XY2019": Changed database context to 'master'. ALTER DATABASE [VMcL_6XY2019] SET OFFLINE WITH ROLLBACK IMMEDIATE Nonqualified transactions are being rolled back. Estimated rollback completion: 0%. Nonqualified transactions are being rolled back. Estimated rollback completion: 100%. Changed database context to 'master'. DROP DATABASE [VMcL_6XY2019] Msg 3709, Level 16, State 2, Server 10-43-15-30\SQL2017, Line 1 Cannot drop the database while the database snapshot "VMcL_dbss1800" refers to it. Drop that database first. Changed database context to 'master'. Msg 50000, Level 11, State 127, Server 10-43-15-30\SQL2017, Line 4 Failed to drop database VMcL_6XY2019 die : Error: drop_database failed At C:\Program Files\Delphix\DelphixConnector\423f7b70-76b6-6eee-d8ad-622a693f2f53-vdb-4\SCRIPT\DropDatabase.ps1:26 char:12 + die <<<< "$($args[0])" + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,die .
Error Code
exception.db.mssqlvdb.vdb.delete.failed
Suggested Action
Make sure that the user "AD\windows_OS_user" has privileges to delete the database.
Key section of the error
Cannot drop the database while the database snapshot "VMcL_dbss1800" refers to it. Drop that database first.
Applicable Delphix Versions
This article applies to the following versions of the Delphix Engine:
Major Release |
Sub Releases |
5.3 |
5.3.0.0, 5.3.0.1, 5.3.0.2, 5.3.0.3, 5.3.1.0, 5.3.1.1, 5.3.1.2, 5.3.2.0, 5.3.3.0, 5.3.3.1, 5.3.4.0, 5.3.5.0, 5.3.6.0 |
5.2 | 5.2.2.0, 5.2.2.1, 5.2.3.0, 5.2.4.0, 5.2.5.0, 5.2.5.1, 5.2.6.0, 5.2.6.1 |
5.1 |
5.1.4.0, 5.1.5.0, 5.1.5.1, 5.1.6.0, 5.1.7.0, 5.1.8.0, 5.1.8.1, 5.1.9.0, 5.1.10.0 |
Resolution
The database snapshot will need to be deleted, this can be done from SQL Server Management Studio:
1. Select the offending Database snapshot, in this example "VMcL_dbss1800".
2. Right-click and select Delete.
3. Press OK on the Delete Object dialog.
4. Try the Refresh/Rollback again.