473,326 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Delete or detach a Suspect database

Everything I read about sp_resetstatus says you must restart SQL after. Is
there a way around that (don't want to shut down production). The suspect
db is just an empty db that is not needed. I need to create another db with
the same name.
Thanks.
Sep 20 '07 #1
3 14684
rdraider (rd******@sbcglobal.net) writes:
Everything I read about sp_resetstatus says you must restart SQL after.
Is there a way around that (don't want to shut down production). The
suspect db is just an empty db that is not needed. I need to create
another db with the same name.
I may be missing something, but what about DROP DATABASE? I made a quick
test on SQL 2000 where I created a database, stopped SQL Server, deleted
the log file to make the database suspect, and restarted SQL Server.
DROP DATABASE worked just fine.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Sep 20 '07 #2
No queries would work since this database did not exist in
Master.sysdatabases. Not sure why. Attempting to detach from Enterprise
Manager produced an error. Then I simply closed and reopened EM and it was
gone! Odd.

"Erland Sommarskog" <es****@sommarskog.sewrote in message
news:Xn**********************@127.0.0.1...
rdraider (rd******@sbcglobal.net) writes:
>Everything I read about sp_resetstatus says you must restart SQL after.
Is there a way around that (don't want to shut down production). The
suspect db is just an empty db that is not needed. I need to create
another db with the same name.

I may be missing something, but what about DROP DATABASE? I made a quick
test on SQL 2000 where I created a database, stopped SQL Server, deleted
the log file to make the database suspect, and restarted SQL Server.
DROP DATABASE worked just fine.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx

Sep 21 '07 #3
rdraider (rd******@sbcglobal.net) writes:
No queries would work since this database did not exist in
Master.sysdatabases. Not sure why. Attempting to detach from Enterprise
Manager produced an error. Then I simply closed and reopened EM and it was
gone! Odd.
The last thing you should believe is a graphical tool. But they usually
offer a Refresh option to handle such situations.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Sep 21 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: DBA | last post by:
If I detach a database on a server, then attach the database with a single file only using the data file...will I lose any transactions that were in the original log file? There is a debate going...
0
by: Roald | last post by:
I am working on an application that needs to implement logical deletes instead of removing the records permanently. The logical delete works by setting 3 fields (deleted flag, date and user). I...
29
by: Jon Slaughter | last post by:
Is it safe to remove elements from an array that foreach is working on? (normally this is not the case but not sure in php) If so is there an efficient way to handle it? (I could add the indexes to...
2
by: =?Utf-8?B?Um9nZWxpbw==?= | last post by:
so I notice to detach a database you use Server svr = new Server(); svr.DetachDatabase("MyDatabase"); but is there a way you can set where its saved after detaching ? thansk
2
by: =?Utf-8?B?QmV0bw==?= | last post by:
I am developing a ASP.NET application, with C# code-behind classes; with SQL Server 2000. All database access is made through stored procedures. I can insert, select and update in all tables...
1
by: RP | last post by:
I am using SQL Server 2005 with C# 2005. I want to programmatically Detach a database, then copy its files from the data folder to another location and then Attach the database back. Can it be done...
36
by: pearl146 | last post by:
Hi, I have some database files (.MDF, .LDF,...) on the server. When I try to delete them, the warning "Cannot delete file: There has been a sharing violation. The source or destination file may...
9
by: dpatel75 | last post by:
I am trying to copy a database from a SQL 2000 SP3 Windows 2000 server to a 2005 SP2 Windows 2003 server. I am trying to use detach and attach method (have tried both within Management Studio and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.