Home » Blog » SQL Server » How to Recover Deleted Database in SQL Server Without Backup

How to Recover Deleted Database in SQL Server Without Backup

Neeraj Kumar
Published By Neeraj Kumar
Debasish Pramanik
Approved By Debasish Pramanik
Published On
Last Updated

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.

SituationFiles on DiskMethod
Dropped while offlineYes#1
Detached before the deleteYes#1
Dropped while onlineNo#2 or #3
Rows or objects deleted in a live databaseYes#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.

FeatureReattach FilesFind Another CopyRecovery Software
CostFreeFreeFree scan and licensed export
Best forOffline or detached databasesServers with shadow copies or snapshotsDeleted objects and damaged files
NeedsMDF and LDF files in the data folderAn MDF file duplicateWindows PC and an MDF duplicate
Main limitFiles are gone after an online dropCopy can be outdatedTrial 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

  1. Open the recovery software from the Start menu. Recovery software home screen
  2. Press Open and choose FarmDB.mdf from the copied folder. Open button Select MDF file window
  3. Mark Advance Scan in the scan window and tick Recover Deleted Objects. Advance Scan option
  4. Review the scan report when scanning finishes. Scan report
  5. Expand Tables in the tree. Deleted items show in red and a click opens their rows. Deleted objects in red

Export the Database to SQL Server

  1. Click Export in the top bar. Export button
  2. Choose the SQL Server Database button under Export To/As. Export options
  3. Choose your server in Server Name and select Windows Authentication. Windows Authentication option
  4. Choose Create New Database and enter FarmDB_Recovered in Database Name. Create New Database option Database name box
  5. Accept the default collation in Collation Settings or select another. Default collation
  6. 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. Database components list Export deleted objects option
  7. Confirm the Export Completed message. Refresh Databases in SSMS to see FarmDB_Recovered. Export Completed window Recovered database in SQL Server

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:

ProblemReasonFix
Attach reports an access errorFolder rights exclude the SQL Server service accountGrant that account access to the folder
Attach reports a missing fileAn NDF file sits on another pathGive the current path of that file in the statement
Data folder is empty after the dropAn online drop deleted the filesUse Method #2 or Method #3 on a copy
Copied file shows older dataThe shadow copy or snapshot predates the latest dataCompare row counts with your reports
Software shows no red objectsThe scan excluded deleted itemsRepeat 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.
  Neeraj Kumar

By Neeraj Kumar

Neeraj Kumar is a Principal Technical Architect at EmailDoctor with 19+ years of experience in email migration, cloud migration, data recovery and digital forensics. He guides enterprise teams through Exchange, Office 365 and Google Workspace projects and shares what works as an EmailDoctor writer. Every method in his posts is tested on Windows and Mac before it goes live.