sql-serversql-server-2014snapshot

Can't delete database snapshot SQL Server, Error: 946


I need to drop a snapshot of a database using SQL Server 2014 (in order to drop the database itself). When I attempt to drop the database...

EXEC msdb.dbo.sp_delete_database_backuphistory @database_name = N'xxx'
GO

USE [master]
GO

DROP DATABASE [xxx]
GO

I get the following error...

Drop failed for Database 'xxx'. (Microsoft.SqlServer.Smo)

ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

Cannot open database 'xxx' version 706. Upgrade the database to the latest version. (Microsoft SQL Server, Error: 946)

https://drive.google.com/file/d/0B3S2sioQNnAwSEs1RmN6UDJ2N0U/view?usp=sharing

Could this be a result of a connection that needs to be closed?


Solution

  • I found the solution to this problem. I simply needed to execute the below statements.

        ALTER DATABASE [Your DB Here] SET OFFLINE
        Drop database [Your DB snapshot here]