HiveBrain v1.2.0
Get Started
← Back to all entries
debugsqlMinor

Unable to fully drop a database snapshot

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
unabledatabasedropsnapshotfully

Problem

I have a job that drops and re-creates a snapshot, it's currently failing when trying to create the database as it says the database already exists.

The database however does not have an entry in master.sys.databases, and is not visible in SSMS.

The [database].ss file does exist, and I can even run queries on tables in the database.

I'm not sure how to drop the database fully however, if I try to drop, I get the folowing:

drop database [database_snapshot]

Msg 3701, Level 11, State 11, Line 1
Cannot drop the database '[database_snapshot]', because it does not exist or you do not have permission.


(I know it's not a permissions issue)

Similarly I am unable to create the database:

CREATE DATABASE [database_snapshot] ON 
(Name = N'[database]', FILENAME = N'[path to .ss]')
AS SNAPSHOT OF [database]

Msg 1801, Level 16, State 3, Line 2
Database '[database_snapshot]' already exists. Choose a different database name.


If anyone has ideas on how to proceed here, it would be most appreciated. :)

Solution

We ended up renaming the .ss file while the service was down. When it came back up again we could create a new snapshot. It's not ideal that services had to be down for us to resolve this, but it's better than nothing.

Context

StackExchange Database Administrators Q#213025, answer score: 2

Revisions (0)

No revisions yet.