[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

how to drop a suspect database with MS/SQL

I have a database marked as suspect in MS/SQL.
The reason is simple : the data files are not there anymore.
In fact I had to restart MS/SQL after copying back all the ldf and mdf files that were savec when MS/SQL was down, but one extremely large database used for test I didn't copy back as I don't need it anymore (I need it empty but with no data).
But now MS/SQL of course says it is market as suspect which is normal.
How can I definitively drop it then create it back from scratch ?
I do not want (too long) to copy back the corresponding ldf and mdf files which of course is one solution, but too long for me.
0
LeTay
Asked:
LeTay
  • 2
1 Solution
 
mokuleCommented:
execute script

DROP DATABASE YourSuspectDB

From BOL
To use DROP DATABASE, the database context of the connection must be in the master database.

DROP DATABASE removes damaged databases marked as suspect and removes the specified database. Before dropping a database used in replication, first remove replication. Any database published for transactional replication, or published or subscribed to merge replication cannot be dropped. For more information, see Administering and Monitoring Replication. If a database is damaged and replication cannot first be removed, in most cases you still can drop the database by marking it as an offline database.

A dropped database can be re-created only by restoring a backup. You cannot drop a database currently in use (open for reading or writing by any user). When a database is dropped, the master database should be backed up.

System databases (msdb, master, model, tempdb) cannot be dropped.

0
 
mokuleCommented:
If You haven't got script for this DB generate it before dropping !!
in EM Tools|Generate SQL Script..
select all options except only script 7.0 compatible..
0
 
LeTayAuthor Commented:
Indeed scripting from ISQL works !
I was trying from the SQL Server Enterprise Manager which looks buggy ? (MS/SQL 7.0 service pack 1)
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now