Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #1278

Re: deleting an invalid database

From Erland Sommarskog <esquel@sommarskog.se>
Newsgroups comp.databases.ms-sqlserver
Subject Re: deleting an invalid database
Date 2012-09-11 23:19 +0200
Organization Erland Sommarskog
Message-ID <XnsA0CBED3E370BCYazorman@127.0.0.1> (permalink)
References <b3e50d91-9edf-477c-9295-eeab989c67d9@r14g2000vbd.googlegroups.com>

Show all headers | View raw


Dom (dolivastro@gmail.com) writes:
> Somehow I got into this situation.  Looking from the OS, I can see two
> files, MyDB_Data.MDF, and MyDB_Log.LDF.  This database does not appear
> in the SSMS object explorer.  My first thought is, "Attach the
> database, then delete it."  But when I try to attach the database, and
> I pick the file MyDB_Data.MDF, the "Attach Database" window, claims
> the log file is on a non-existent drive.
> 
> First question, "Why does it say that?"  Is the log file path and name
> stored in the database?

Yes.
 
> Second, and most important question, "Is it okay to just delete the
> MDF and LDF at the level of the OS and forget about it?"  I'm certain
> I have no need for the data, because the name is a typical "sandbox"
> name.

If the files are not known to SQL Server, it's seems like a roundabout
way to first attach them and drop them, when you can delete them directly.

But check in sys.databases first. 



-- 
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Find similar


Thread

deleting an invalid database Dom <dolivastro@gmail.com> - 2012-09-11 10:42 -0700
  Re: deleting an invalid database Erland Sommarskog <esquel@sommarskog.se> - 2012-09-11 23:19 +0200

csiph-web