Thursday, June 11, 2015

Error removing SQL SnapShots

When trying to delete some Microsoft SQL Server 2012 (SP1) snapshots, that I created as part of a recovery procedure before upgrading a SharePoint farm to Service Pack 1, I ran against this error:
Drop database [snapshotDbName]
Msg 21, Level 21, State 1, Line 1
Warning: Fatal error 615 occurred at Jun 11 2015  2:51PM. Note the error and time, and contact your system administrator.

Or via the interface:

I knew I had enough rights because I was using the same account that created the snapshots. After trying setting the snapshot-parent-db to single user, etc. etc. I ran into this solution:

 alter database [YourDBName] set emergency

The result will be:
Msg 5093, Level 16, State 1, Line 1
The operation cannot be performed on a database snapshot.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.

BUT, now you ARE able to delete the snapshot using the UI or:
drop database [bwdba_SS]

Don’t know why but .. it works because of the (emergency) herbs :)