Solved

Detach database that has missing data and log file

Posted on 2009-04-08
3
800 Views
Last Modified: 2012-05-06
I was deleting some temporary created and detached databases and accidentally deleted database that is also temporary but not detached (I don't know why the deletion succeeded because it was used by the SQL server). The deletion was from network share and I don't have the files any more. Now I have reference to nonexistent database that I would like to delete and I can't do it from SQL server management studio.
Are the database files protected from deletion from SQL server itself or they simply can't be deleted because they are in use by the server and when no one used the database for a long time, it is possible to delete them?
0
Comment
Question by:Znasev
  • 2
3 Comments
 
LVL 23

Expert Comment

by:adathelad
ID: 24104822
AFAIK, you can't delete the mdf/ldf files for a database that is still attached as SQL Server prevents it?? Was the SQL Server instance running at the time you deleted them? Perhaps it wasn't and so that may be why you was able to delete.
0
 

Author Comment

by:Znasev
ID: 24104851
Yes, the server was running. It was early in the morning, and nobody used it overnight and I guess that is why the system let me delete it. After deleting the files, I successfully connected to the server, and I saw that the database was actually not detached.
0
 

Accepted Solution

by:
Znasev earned 0 total points
ID: 24105235
I checked the server again later and the reference to missing database files is gone. I guess the server cleaned it up.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Suggested Solutions

When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now