Dropping an online database deletes its data and log files and Microsoft names a backup restore as the only official way back. You can recover a deleted database in SQL Server without backup with three methods. You reattach the MDF and LDF files that remain or find another MDF copy in shadow copies or snapshots or on a test server. Recovery software scans the MDF duplicate when attach fails. Test on a copy before the live server.
Someone drops FarmDB from SSMS during a cleanup and the orders application stops at once. No backup plan exists for this server and the data folder looks empty.
Search results for this problem repeat the log sequence number method for deleted rows. Few explain what survives a DROP DATABASE and where the files can still sit.
Learn how to recover a deleted database in SQL Server without backup, including the folder check that decides which method works.
Microsoft states in the DROP DATABASE reference that only a backup restore can bring a dropped database back.
What Happens to the Files After DROP DATABASE?
DROP DATABASE removes the database from the instance and deletes its disk files. Microsoft states that files of a database that was offline at the drop are not deleted. Check the catalog first to confirm the loss.
SELECT COUNT(*) AS db_found
FROM sys.databases
WHERE name = N'FarmDB';
Zero in the count means the instance no longer lists FarmDB. Open the data folder next and look for the MDF and LDF files. Their presence decides the method.
| Situation | Files on Disk | Method |
|---|---|---|
| Dropped while offline | Yes | #1 |
| Detached before the delete | Yes | #1 |
| Dropped while online | No | #2 or #3 |
| Rows or objects deleted in a live database | Yes | #3 |
3 Ways to Recover a Deleted Database in SQL Server Without Backup
Free methods #1 and #2 need a file on disk while Method #3 scans the MDF file and works when attach fails.
| Feature | Reattach Files | Find Another Copy | Recovery Software |
|---|---|---|---|
| Cost | Free | Free | Free scan and licensed export |
| Best for | Offline or detached databases | Servers with shadow copies or snapshots | Deleted objects and damaged files |
| Needs | MDF and LDF files in the data folder | An MDF file duplicate | Windows PC and an MDF duplicate |
| Main limit | Files are gone after an online drop | Copy can be outdated | Trial export limit |
Method #1: Reattach the Files That Remain (Free, Needs MDF and LDF Files)
Look for FarmDB.mdf and FarmDB_log.ldf in the data folder first. As per Microsoft's attach a database, attach needs all data files of the database and file permission for the SQL Server service account.
CREATE DATABASE FarmDB
ON (FILENAME = N'D:\SQLData\FarmDB.mdf'),
(FILENAME = N'D:\SQLData\FarmDB_log.ldf')
FOR ATTACH;
Per Microsoft three permissions allow the attach statement. They are ALTER ANY DATABASE and CREATE DATABASE and CREATE ANY DATABASE. Check the database with DBCC CHECKDB once it is online.
Microsoft states that sp_detach_db removes a database from the server without deleting its files. Detach a database instead of dropping it when its data could be needed later.
Method #2: Find Another Copy of the MDF File (Free, Needs a Copy)
Online drops delete the files on the original path but copies can exist elsewhere. Check four places:
- Shadow copies on the file server. Microsoft states that users recover deleted or modified files stored on the network through Shadow Copies of Shared Folders.
- Virtual machine snapshots. Snapshots and disk images of the SQL Server host store the data folder as it was.
- Test or staging servers. An earlier copy of FarmDB can sit on a server that received it for testing.
- File level backups. Backup tools outside SQL Server can store the data folder as plain files.
Copy the file to a new folder and work on that duplicate. Attach it with Method #1 or scan it with Method #3. Save nothing new to the disk that held the original files.
Details on the shadow copy feature sit in the Microsoft Volume Shadow Copy Service overview.
Method #3: Use EmailDoctor on the MDF Duplicate (Scan Free, Export Licensed)
Method #3 can recover a deleted SQL Server database when attach fails because the MDF file is damaged. Deleted objects inside a live database show up too. EmailDoctor SQL Database Recovery opens an MDF duplicate and lists deleted tables and views and procedures in red.
Save a duplicate of the MDF file in a separate folder before the scan. Trial exports are limited to 25 rows in one table and 5 extra objects.
Find the Deleted Items in the Duplicate
- Open the recovery software from the Start menu.
- Press Open and choose FarmDB.mdf from the copied folder.
- Mark Advance Scan in the scan window and tick Recover Deleted Objects.
- Review the scan report when scanning finishes.
- Expand Tables in the tree. Deleted items show in red and a click opens their rows.
Export the Database to SQL Server
- Click Export in the top bar.
- Choose the SQL Server Database button under Export To/As.
- Choose your server in Server Name and select Windows Authentication.
- Choose Create New Database and enter FarmDB_Recovered in Database Name.
- Accept the default collation in Collation Settings or select another.
- Mark the objects you want in the tree and select With Schema & Data. Add the Export Deleted Objects and Export Deleted Records boxes for deleted items. Then press Export.
- Confirm the Export Completed message. Refresh Databases in SSMS to see FarmDB_Recovered.
What About Deleted Rows Instead of a Database?
Rows removed with DELETE do not remove the database. Trace them with the transaction log or scan the MDF file with Method #3. Step by step fn_dblog instructions sit in the SQL query to find deleted records guide.
How to Stop the Next Accidental Drop?
Microsoft lists four rights that allow DROP DATABASE. They are CONTROL on the database and ALTER ANY DATABASE permission and membership in dbcreator and membership in db_owner. List the members of dbcreator first.
SELECT m.name
FROM sys.server_role_members AS rm
JOIN sys.server_principals AS r ON r.principal_id = rm.role_principal_id
JOIN sys.server_principals AS m ON m.principal_id = rm.member_principal_id
WHERE r.name = N'dbcreator';
Remove members who do not manage databases and schedule a full backup of FarmDB.
BACKUP DATABASE FarmDB
TO DISK = N'E:\Backups\FarmDB_Full.bak'
WITH CHECKSUM;
Microsoft states that SQL Server can drop a database in any state including offline and suspect. Databases in use cannot be dropped.
Which Problems Stop the Recovery?
Five problems stop most recoveries:
| Problem | Reason | Fix |
|---|---|---|
| Attach reports an access error | Folder rights exclude the SQL Server service account | Grant that account access to the folder |
| Attach reports a missing file | An NDF file sits on another path | Give the current path of that file in the statement |
| Data folder is empty after the drop | An online drop deleted the files | Use Method #2 or Method #3 on a copy |
| Copied file shows older data | The shadow copy or snapshot predates the latest data | Compare row counts with your reports |
| Software shows no red objects | The scan excluded deleted items | Repeat the scan and tick Recover Deleted Objects |
Use Method #3 when attach fails. Scan a duplicate and never the original.
Frequently Asked Questions
Can a Dropped SQL Server Database Return Without a Backup?
Yes. Reattach the files when they remain on disk or scan an MDF duplicate with recovery software. Microsoft names a backup restore as the only official way to bring a dropped database back.
Does DROP DATABASE Delete the MDF File?
Yes. Microsoft states that the physical disk files of the database are deleted. Files of a database or file that was offline at the drop remain.
Is There a Recycle Bin for a Dropped Database?
No. SQL Server removes the database at once. Use remaining files or another copy or recovery software.
Does Detach Delete the Files?
No. Microsoft states in the detach a database guide that detached files remain in the file system. Attach them with CREATE DATABASE and FOR ATTACH.
Do I Need the Original Folder to Attach Files?
No. Microsoft states that you must give the current path of any file that differs from its creation path.
Can I Drop a Database in Use?
No. Microsoft states that a database in use cannot be dropped. Any user session that uses the database counts as use.
Can I Drop a System Database?
No. System databases cannot be dropped per Microsoft.
Which Permissions Allow DROP DATABASE?
Microsoft lists CONTROL on the database and ALTER ANY DATABASE permission and membership in dbcreator or db_owner.
Does Recovery Software Need the Original Server?
No. Scanning needs only an MDF duplicate. Export to a SQL Server database needs a server to connect to.
Does the Trial Version Have an Export Limit?
Yes. Trial exports include at most 25 rows in one table and 5 extra objects. Licensing lifts the restriction.
Author’s Verdict
DROP DATABASE has no undo and Microsoft names a backup restore as the only official way back. Check the data folder first because the files decide how you recover a deleted database in SQL Server without backup.
Reattach files that remain and search for another copy when they are gone. Recovery software scans the copy when attach fails or objects are missing.
Schedule a full backup of FarmDB today and limit who can drop databases.
- Dropping an online database deletes its disk files and no undo exists.
- Offline and detached databases retain their files and attach with CREATE DATABASE and FOR ATTACH.
- Shadow copies and snapshots and staging servers can store another MDF copy.
- Recovery software scans the duplicate and exports deleted objects to a new database.
- Full backups and a short list of users with drop rights prevent the next loss.
- Try every step on a test copy first.