When you drop a database in SQL Server, the data files are deleted from disk, and the drop is logged but not reversible with a simple undo. Your fastest recovery path is always a full backup taken before the drop, restored with RESTORE DATABASE (using WITH REPLACE, RECOVERY if the database name still exists in metadata). If you have no backup, your only realistic options are a tail-log restore from a database that was in full recovery model, file-level salvage from the volume, or a restore from a server-level copy kept elsewhere. The article below walks each path in order, tells you what must be true before you start, and explains how to check that the restore actually worked.

Dropping a database is a moment most DBAs would like to take back. SQL Server doesn't offer a native UNDROP statement in any shipping version through SQL Server 2025, and Microsoft has consistently pointed to backups as the recovery mechanism. That means the practical answer depends less on clever commands and more on what you set up before the accident. The good news: if you have a recent full backup, the recovery is quick and reliable. If you don't, the situation ranges from "restore the tail log within minutes" to "call a professional before writing anything else to that disk."

Before you start, confirm three things: your SQL Server service account still has write access to the target folder, the destination path for the restored files has enough free space for the MDF and LDF files (usually equal to or larger than what the database used before the drop), and you know the exact name and file paths of every database you're restoring. If the database was part of an availability group, mirrored pair, or log-shipping configuration, pause those dependencies first so the restore doesn't trigger a re-seed or fail because the database is still enrolled.

Path 1: Restore From a Full Backup (the Reliable Route)

This is the standard, supported recovery. It works when you have a full backup of the database taken at or before the drop, plus any differential and log backups you need to reach a specific point in time.

Prerequisites: A full backup file with a known path and a verifiable file header. If the database was in full recovery model, a log backup taken after the last data change you want to recover. Note that if you never backed up the log, SQL Server may have truncated it, which breaks point-in-time recovery. SQL Server sysadmin rights on the target instance, or a login with CREATE ANY DATABASE and RESTORE permissions. Free disk space on the target volume.

Steps:

1: Verify the backup file exists and is readable. In SSMS, right-click Databases > Restore Database > Device, add the file, and click Contents. Or use RESTORE HEADERONLY FROM DISK = N'C:\Backups\MyDB_full.bak' and confirm the DatabaseName and BackupFinishDate match what you expect. 2: Run RESTORE FILELISTONLY FROM DISK = N'C:\Backups\MyDB_full.bak' to see the logical file names and the original physical paths. If you're restoring to the same instance, the original paths are usually fine; if the instance changed, plan for WITH MOVE. 3: If the database name still exists in sys.databases (a drop can fail partway or a new database can collide with the old name), drop the stub or restore with a new name and rename later. Use WITH REPLACE only when you understand it will overwrite any existing database files. 4: Execute the restore, using WITH NORECOVERY if you plan to apply a differential or log backup next, and WITH RECOVERY only for the final restore in the chain: 5: If you have a differential backup taken after the full, restore it next with WITH NORECOVERY. Then restore log backups in sequence, each with WITH NORECOVERY, until the point in time you need. For a final point-in-time restore on a log: 6: Check success: query sys.databases and sys.master_files for the state (ONLINE) and the file paths, then run DBCC CHECKDB (MyDB) WITH PHYSICAL_ONLY to catch obvious corruption. Spot-check row counts on a couple of key tables against your last known-good numbers.

If RESTORE returns "The media set has 1 media families but 2 are required," you're missing one file in a striped backup set. If it returns "The log or differential backup cannot be restored because no files are ready to rollforward," your restore chain is broken and you need an earlier full or differential.

Path 2: Tail-Log Restore From a Database Still in Recovery

This is the closest thing to an undo, but it only applies in a specific situation: the database was dropped but the underlying data is still logically reachable via a tail-log backup of the log, and the database was in full or bulk-logged recovery model. In practice, SQL Server deletes the data files when the drop commits, so a tail-log backup taken after the drop usually cannot run — the database no longer exists to back up. However, if the drop was inside a transaction that hasn't yet been committed and you still have an active session, or if the drop occurred on a replica where the primary still holds the log, you may be able to capture what you need before it's gone.

Realistically, the useful scenario here is: someone drops a database that had log backups shipped to another location, and you're able to restore the last log backup that was taken just before the drop, combined with an earlier full backup. The sequence is the same as Path 1, with STOPAT set to the last moment before the drop.

Expect this to take minutes, not hours, for small databases. For a multi-terabyte database, the log restore could be the long part of the process. If you don't know how many log backups you have, run SELECT * FROM msdb.dbo.backupset WHERE database_name = 'MyDB' ORDER BY backup_finish_date DESC (if msdb survived) or check your backup tool's catalog.

Path 3: Recover From a Server-Level Copy (Always-On, Log Shipping, Snapshots)

If your database was an availability-group database, the drop on the primary typically triggers a drop of the secondaries, so "just fail over" is not a recovery. But if you have a copy of the database on a witness server, in a testing environment, or inside a VM snapshot or storage snapshot taken before the drop, that copy can be restored or attached. For file-level copies, CREATE DATABASE MyDB ON (FILENAME = ...) FOR ATTACH works if the MDF is consistent and the LDF is either present and consistent or the database was cleanly shut down.

For storage snapshots (NetApp, Pure, SAN-level), the recovery is a restore operation on the storage array, then DBCC CHECKDB before you put the database back into service — a snapshot is not a SQL Server backup and may capture a torn write if taken while the database was active.

Path 4: File Salvage When You Have No Backup

This is the last resort, and it's where patience and discipline matter most. When SQL Server drops a database, it deletes the physical MDF and LDF files through the operating system. Those files' contents may persist on disk until the space is overwritten. Stop writing to that volume immediately — every new write reduces your chance of recovery.

Steps that make sense before you escalate:

1: Take the SQL Server service offline or at least stop all non-essential writes to that volume. Make a sector-level image of the volume first if you can; work from the image, not the original. 2: Try file-recovery utilities that support SQL Server MDF/LDF structures, and SQL Server's own DBCC CHECKDB on any recovered file once you have one. A recovered MDF must pass a consistency check before you trust it; a half-recovered file attached with FOR ATTACH_REBUILD_LOG can produce silent corruption that surfaces later. 3: Expect that a clean recovery is unlikely without a proper backup. The MDF header and allocation structures are complex, and partial file recovery rarely produces a database you can trust for production.

Stop condition: if the data is business-critical, involves regulated records, or you cannot verify the integrity of any recovered file, engage a data-recovery specialist or Microsoft support before attempting further writes to the volume. DIY attempts with recovery tools can overwrite exactly the blocks you need.

Decision Table: Which Path Fits

Situation Best first move Realistic recovery time Data loss risk
Full backup exists, taken before the drop RESTORE DATABASE ... WITH RECOVERY (or NORECOVERY plus log chain) Minutes to a few hours depending on size Up to the time of the last backup/log
Full + log backups, full recovery model Restore full, then logs with STOPAT just before the drop Longer; log replay can dominate Near zero if STOPAT is accurate
Availability-group primary dropped Check whether secondaries were dropped; restore from a copy if one survives Depends High unless a copy survives
Storage snapshot pre-drop Restore snapshot, DBCC CHECKDB Fast on storage, slow if CHECKDB runs long Up to the snapshot time
No backup at all Stop writes, image the volume, try salvage Days and uncertain Very high

Use the table as a starting point, not a substitute for checking your actual backup catalog. A backup that exists but has never been restored is a hypothesis; the only way to know it works is to test it.

Numbering and Naming Gotchas That Trip People Up

Two recurring issues cause restores of dropped databases to fail in ways that look mysterious.

First, the database name may still exist as a "stub" in sys.databases if the drop was interrupted or if a different database has since been created with the same name. In that case, RESTORE DATABASE MyDB will fail with "Database 'MyDB' already exists." You either drop the stub (verify it isn't the database you actually want) or use RESTORE DATABASE MyDB_restored ... WITH MOVE and rename afterward with ALTER DATABASE ... MODIFY NAME.

Second, if the database had been renamed at some point, the logical file names inside the backup won't match its current name. RESTORE FILELISTONLY reveals the mismatch, and WITH MOVE fixes it. Skipping this step is the most common cause of "the file cannot be restored because it already exists" errors when restoring a dropped database to the same instance.

A Worked Estimate: How Long Restore Actually Takes

Suppose you have a 200 GB database on a server with a 500 MB/s backup-to-disk restore rate (typical for a mid-range SAN), a full backup, and three log backups taken in the hours before the drop. The full restore at that rate moves roughly 200 GB ÷ 0.5 GB/s ≈ 400 seconds, or about 7 minutes of pure data transfer. In practice, SQL Server's restore is single-threaded per backup file unless you use striped backups, and log replay adds time proportional to the amount of logged work. Assume 15–30 minutes for the full restore, plus 2–5 minutes per log backup for the replay. A realistic deadline is 30–45 minutes from kickoff to an online database you can check — but if the same restore has to run against a slow network share or a busy array, double it. The honest planning number is: measure your own environment with a restore of a copy, because a claim like "a 200 GB database restores in seven minutes" is arithmetic, not a guarantee.

Preventing the Next Dropped Database

The best time to solve this problem is before it happens. Three changes cover most of the risk:

Test your backups monthly by restoring to a scratch instance. A backup that has never been restored is untested; the only restore you can trust is one you've done before the emergency. Keep a copy of the full backup on a different server or storage system than the production instance. If both copies live on the same SAN that hosts the data, a single storage failure removes both the database and the backup. Restrict ALTER ANY DATABASE / DROP DATABASE permissions. Dropping a database requires the dbcreator or sysadmin role or an explicit grant; most users don't need either on production.

If your database is small and business-critical, consider database snapshots for point-in-time recovery within a window — but understand that a snapshot is not a backup (it depends on the source database being intact) and it does not survive the source database being dropped.

For high-value data, run a periodic restore drill and record how long it takes in your environment. That number is your real recovery time objective, and it is almost always larger than the back-of-envelope estimate.