Quick Answer
Recover a dropped database in SQL Server by restoring its backups. DROP DATABASE deletes the database files from disk, so Microsoft states a restore of a full backup is the only way back. You get 3 ways. Find the backup files in the msdb history and restore the full backup and the log backups. Rebuild the backup list from the backup folder when the history is gone. Scan an MDF file with recovery software when the database was offline at the drop or you saved a copy of the file. Our test showed the msdb history survives a T-SQL drop and the restore returned all 5 rows.
A dropped database feels final because the files vanish with it. The backups and their history do not vanish, and that is where your recovery starts.
This guide shows what DROP DATABASE removes, what it leaves behind and which of the 3 fixes fits the files you still have. We executed the T-SQL on SQL Server 2022 and the results sit next to the steps.
Which Fix Fits the Files You Still Have?
| What you have | What it means | What to do |
|---|---|---|
| Full backup and log backups | You restore up to the last log backup | Use Method #1 |
| Full backup only | You lose every change after that backup | Use Method #1 |
| Backup files but no msdb history | SQL Server no longer lists the files | Use Method #2 |
| No backup but an MDF copy, a detached MDF or a database that was offline at the drop | The file still sits on disk | Use Method #3 |
| No backup and no file anywhere | Nothing is left to read, so no recovery software helps | Check VM snapshots and volume backups |
What Does DROP DATABASE Remove and What Does It Leave?
Microsoft states DROP DATABASE deletes the database from the instance and deletes its physical files. When the database or one of its files is offline at the drop, the files stay on disk. To retain the files and remove the database from the server, Microsoft points to sp_detach_db.
The log file is one of the files that disappear, so the log of a dropped database cannot help you. Log backups taken before the drop can.
We dropped a FULL recovery database that had one full backup and one log backup. We then checked the msdb history.
| What we checked | Result on our test instance |
|---|---|
| Backup history after the T-SQL DROP DATABASE | The full and the log backup rows were still listed with their file names |
History after sp_delete_database_backuphistory |
0 rows left for the database |
| Restore of the full backup and the log backup | Database came back ONLINE in FULL recovery with all 5 rows |
| Default trace entry for the drop | None on our Linux test instance |
Do not count on the default trace to find the drop time. Check your own audit setup or ask the person who dropped the database.
Heads Up
Do not execute sp_delete_database_backuphistory on a database you could need back. Microsoft states it deletes the history rows from 8 backup and restore tables.
What Does the Restore Need on Your Server?
System Specifications
| Component | Requirement |
|---|---|
| Disk space | Free space for the restored data and log files |
| Backup files | The full backup file and every log backup file after it must still exist on disk or on a share |
| Permission to restore | CREATE DATABASE to restore into a new or a dropped database name |
| PC for the recovery software | Windows up to Windows 10 with 512 MB of RAM and 50 MB of free disk space |
Software Specifications
| Item | Requirement |
|---|---|
| Restore of logs | FULL or bulk logged recovery model at the time of the backups |
| History tables | The msdb database of the same instance, unless someone removed the rows |
| Recovery software | Lists SQL Server 2019 and earlier |
| Tested on | SQL Server 2022 (RTM CU26) Express on Linux |
How do You Recover a Dropped Database in SQL Server?
Method #1: Restore the Full and Log Backups (Free, Needs Backups)
Use this method when msdb still lists the backups. The query below shows every backup of the dropped database in time order with its file name.
SELECT bs.database_name, bs.type, bs.backup_finish_date,
bs.first_lsn, bs.last_lsn, bmf.physical_device_name
FROM msdb.dbo.backupset AS bs
JOIN msdb.dbo.backupmediafamily AS bmf ON bs.media_set_id = bmf.media_set_id
WHERE bs.database_name = N'YourDB'
ORDER BY bs.backup_finish_date;
The type column shows D for a full backup and L for a log backup. Copy the file names and restore in order. Use NORECOVERY on every step except the last.
RESTORE DATABASE YourDB FROM DISK = N'D:\Backups\YourDB_full.bak' WITH NORECOVERY;
RESTORE LOG YourDB FROM DISK = N'D:\Backups\YourDB_log.trn' WITH RECOVERY;
Our test restored the full backup with NORECOVERY and the log backup with RECOVERY. The database came back ONLINE with 3 rows from the full backup and 2 rows from the log backup.
Check a backup file before you rely on it. A backup made with CHECKSUM passes this test.
RESTORE VERIFYONLY FROM DISK = N'D:\Backups\YourDB_full.bak' WITH CHECKSUM;
Our test returned the line The backup set on file 1 is valid. Our SQL Server point in time restore guide shows how to stop before a bad statement and our restoring state guide explains what to do when the database stays in RESTORING.
Method #2: Rebuild the Backup List When the History Is Gone (Free)
Use this method when the backup files exist but msdb no longer lists them. This happens after sp_delete_database_backuphistory or after a history cleanup job.
- Open the backup folder and sort the files by date.
- Check every file with
RESTORE HEADERONLYto see its database name, type and finish time. - Check the logical file names with
RESTORE FILELISTONLYbefore you restore. - Restore the oldest full backup first and then the log backups in order, as Method #1 shows.
RESTORE HEADERONLY FROM DISK = N'D:\Backups\YourDB_full.bak';
RESTORE FILELISTONLY FROM DISK = N'D:\Backups\YourDB_full.bak';
Match the first and last LSN values of the headers. A log backup that does not start where the last restore ended leaves a gap and SQL Server refuses it.
Method #3: Scan the MDF File With SQL Recovery Utility (Paid, No Backup Needed)
Use this method when you have no usable backup but an MDF file survives. That file can be a copy, a detached file or the file of a database that was offline when it was dropped. SQL Recovery Utility opens the MDF file without a live SQL Server and previews the items it finds.
- Click Open and select the .mdf file of the database.
- Select Advanced Scan, choose the SQL Server version and tick the option to preview deleted objects.
- Check the preview for your tables and records.
- Select SQL Server Database, enter the login details and select a new or an existing database.
- Select With schema and data and click Export.



SQL Recovery Utility
Scan an MDF file and export recovered tables and records.
Heads Up
Scan a copy of the MDF file and work on the copy only. Store the original elsewhere untouched until you check the exported data.
How do You Protect a Database From an Accidental Drop?
- Take a full backup before any drop. Microsoft advises it and states you can recreate a deleted database only by restoring a full backup.
- Detach instead of drop when you want to retain the files. Microsoft names
sp_detach_dbfor this. - Back up master. Microsoft states a restored master still lists databases you deleted since its last backup.
- Retain the msdb history. Our test showed the history is the fastest map to your backup files.
- Test a restore on a copy. Our test needed one full restore and one log restore and finished at once.
FAQs
Can You Recover a Dropped Database Without a Backup?
Only when an MDF file still exists. DROP DATABASE deletes the files, so you need a copy of the file or a database that was offline at the drop. Recovery software then scans that file as Method #3 shows.
Does DROP DATABASE Delete the MDF and LDF Files?
Yes. Microsoft states it deletes the physical disk files. The files stay on disk when the database or one of its files is offline at the drop.
Does Dropping a Database Delete Its Backups?
No. In our test the backup files and their msdb history stayed after the drop and the restore worked from those files.
Can You Recover a Dropped Database From the Transaction Log?
No. The log file is deleted with the database. Log backups taken before the drop work in a restore as Method #1 shows.
Where Does SQL Server Store the Backup History of a Dropped Database?
In the backupset and backupmediafamily tables of the msdb database. Our test listed both backups there after the drop.
How Do You Find When a Database Was Dropped?
Our test default trace had no drop event on Linux, so do not rely on it. Use your audit logs or ask the person who dropped it. Our guide on how to check when a database was deleted shows more options.
About this guide
We checked this guide against Microsoft documentation on 2 Dec 2026. We executed the DROP DATABASE, msdb history, sp_delete_database_backuphistory, RESTORE DATABASE and RESTORE LOG statements on SQL Server 2022 (RTM CU26) Express on Linux.
Microsoft documents the drop behavior on its DROP DATABASE page and the history cleanup on its sp_delete_database_backuphistory page.
