Ritridata Logo
Ritridata
Data Recovery for Windows
Windows 11/10/8/7 support
Data Recovery for Mac
macOS Sonoma & earlier
Hard Drive Recovery
SD Card Recovery
External Drive Recovery
Crashed System Recovery
Disk Image Recovery
Mac File Recovery
Recycle Bin Recovery
Solutions
Pricing
DownloadSign In
Home windows computer solutions Restore SQL Database From .bak File 2026: Step-by-Step

How to Restore a SQL Server Database From a .bak File — Complete 2026 Guide

Ethan CarterEthan Carter
|Last Updated: March 14, 2026| 100% Safe

Restoring a SQL Server database from a .bak backup file is straightforward with SSMS or T-SQL.
This guide covers both methods plus fixes for the most common errors you will encounter.

Free Download

Restoring a SQL Server database from a .bak file is a core SQL Server administration task performed after data loss, system migration, or a disaster recovery event. This guide covers the full process through both SQL Server Management Studio (SSMS) and T-SQL, including fixes for the most common errors.


Part 1. Prerequisites Before Restoring

Before starting the restore process, verify these conditions:

RequirementWhy It Matters
SQL Server version compatibilityCannot restore from a newer SQL Server version to an older one
.bak file accessibilityFile must be accessible from the SQL Server instance's local path or a UNC share
Sufficient disk spaceThe restored database requires space equal to or greater than the original
Target database does not exist (or you intend to overwrite)Restore to an existing database requires WITH REPLACE
SQL Server service account permissionsThe service account needs read access to the .bak file location

💡 Tip: Check your SQL Server version before restoring: run SELECT @@VERSION in SSMS. A .bak file from SQL Server 2019 cannot be restored to SQL Server 2016 — the version compatibility only goes in one direction.

If restoring to a different server, copy the .bak file to a local path on the target server first. Network paths work but add latency and potential access errors.


Part 2. Method 1 — Restore Using SSMS (GUI)

SQL Server Management Studio provides a graphical restore wizard that handles most common scenarios without writing T-SQL.

Steps:

  1. Open SSMS and connect to your SQL Server instance.
  2. In Object Explorer, right-click Databases and select Restore Database.
  3. In the Restore Database dialog, select Device and click the ... button.
  4. Click Add, navigate to your .bak file, and click OK.
  5. SSMS populates the database name automatically from the backup header. Verify it.
  6. Go to the Options page (left panel).
  7. If restoring over an existing database, check Overwrite the existing database (WITH REPLACE).
  8. Review the Restore the database files as section — confirm the file paths for .mdf and .ldf exist on the target server.
  9. Set recovery state to RESTORE WITH RECOVERY (for a fully usable database after restore).
  10. Click OK to start the restore.

🗣️ r/SQLServer user: "The GUI is fine for one-off restores. Just make sure you check the file paths on the Options page — that's where 90% of restore errors come from. The default paths in the .bak often don't match the new server's directory structure."

A progress bar displays during the restore. For large databases (100 GB+), this can take 30+ minutes.


Part 3. Method 2 — Restore Using T-SQL RESTORE Command

The T-SQL RESTORE command provides more control and is essential for scripted or automated restore workflows.

Basic restore command:

RESTORE DATABASE [YourDatabaseName]
FROM DISK = 'C:\Backups\YourDatabase.bak'
WITH REPLACE,
     RECOVERY,
     STATS = 10;

Restore to a different file location (common when migrating servers):

RESTORE DATABASE [YourDatabaseName]
FROM DISK = 'C:\Backups\YourDatabase.bak'
WITH MOVE 'YourDatabase_Data' TO 'D:\SQLData\YourDatabase.mdf',
     MOVE 'YourDatabase_Log' TO 'D:\SQLLogs\YourDatabase_log.ldf',
     REPLACE,
     RECOVERY,
     STATS = 10;

💡 Tip: To find the logical file names inside a .bak file (needed for the MOVE clause), run this first: RESTORE FILELISTONLY FROM DISK = 'C:\Backups\YourDatabase.bak'

T-SQL OptionEffect
WITH RECOVERYDatabase comes online after restore (default for final restore)
WITH NORECOVERYDatabase stays in restoring state (use when applying more logs)
WITH REPLACEOverwrites an existing database with the same name
WITH STATS = 10Reports progress every 10%
WITH MOVERedirects data/log files to new paths

Part 4. Fix Common Restore Errors

Error: "The file is in use by another process"

This occurs when the target database is open or has active connections.

Fix:

USE master;
ALTER DATABASE [YourDatabaseName] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
-- Then run your RESTORE command

Error: "Cannot open backup device — Operating system error 5 (Access is denied)"

Fix: The SQL Server service account lacks read permission on the .bak file location.

  • Right-click the .bak file → Properties → Security → Add the SQL Server service account with Read permission.
  • Or move the .bak to C:\Program Files\Microsoft SQL Server\MSSQL\Backup\ which the service account can typically access by default.

Error: "The database cannot be opened because it is version X. This server supports version Y"

⚠️ Important: SQL Server databases cannot be restored to an older version of SQL Server. A .bak from SQL Server 2022 cannot be restored to 2019. Your only option is to restore to an equal or newer version, or use the Export/Import Wizard to transfer data schema and contents instead.

Error: "Restore of database failed — directory lookup failed"

The restore is trying to create database files in a path that does not exist. Use the WITH MOVE clause to redirect files to a path that exists on the target server.

🗣️ r/sysadmin user: "Every time I move a database to a new server, the restore fails because the original D:\Data path doesn't exist. The MOVE clause fixes it every time. I keep a script template ready for this exact scenario."


Part 5. Restore Specific Backup Types

SQL Server supports several backup types that may be combined:

Backup TypeDescriptionRestore Order
Full backup (.bak)Complete database snapshotRestore first, WITH NORECOVERY if applying more
Differential backup (.bak)Changes since last full backupRestore after full, WITH NORECOVERY
Transaction log backup (.trn)Log records since last backupRestore in sequence after full/differential

For a full restore chain:

  1. Restore full backup WITH NORECOVERY
  2. Restore differential backup WITH NORECOVERY
  3. Restore each transaction log in order WITH NORECOVERY
  4. Apply final recovery: RESTORE DATABASE [Name] WITH RECOVERY

Part 6. Recover a Deleted .bak File

If the .bak file itself was accidentally deleted before you could restore it, standard file recovery tools can retrieve it from the disk sectors — as long as the drive has not been heavily written since the deletion.

Ritridata can recover deleted .bak files from NTFS and exFAT volumes. Scan the drive immediately after discovering the deletion, before any further writes, to maximize recovery success.

Download Ritridata


FAQ

Q: Can I restore a .bak file to a different database name? A: Yes. In the SSMS dialog, change the Database field to a new name. In T-SQL, use RESTORE DATABASE [NewName] FROM DISK = '...'.

Q: Can I restore a SQL Server .bak file without SQL Server installed? A: No. A .bak file is a proprietary SQL Server backup format. You need an equal or newer version of SQL Server Express (free) or Standard to restore it.

Q: How long does a SQL Server restore take? A: Restore speed is roughly 100–300 GB per hour on typical hardware. A 500 GB database might take 2–5 hours. SSDs and fast NVMe storage significantly speed up the process.

Q: Can I restore a .bak file on SQL Server Express? A: Yes, SQL Server Express can restore .bak files. The 10 GB database size limit of Express applies to the database after restore — you cannot restore a database larger than 10 GB to Express.

Q: What is the difference between RESTORE WITH RECOVERY and WITH NORECOVERY? A: WITH RECOVERY makes the database fully accessible after the restore completes. WITH NORECOVERY leaves the database in a "Restoring" state so you can apply additional differential or log backups before bringing it online.


References

  • Microsoft: Restore a database backup using SSMS
  • Microsoft: RESTORE (Transact-SQL)
  • Microsoft: SQL Server backup and restore overview
  • Microsoft: SQL Server version compatibility
  • SQL Server Management Studio download

Related Articles

Excel Won't Save Your File? Here's Why and How to Fix It

Excel saving errors range from a simple read-only file flag to complex issues like corrupt VBA macros or network drive disconnections.
Most cases are fixable by saving with a new name, adjusting permissions, or disabling a conflicting add-in.
Ritridata can recover unsaved or lost Excel files from your drive if needed.

Read Article →

VLC Audio Out of Sync? 5 Ways to Fix Audio Delay in VLC Media Player

VLC audio delay — where audio plays ahead of or behind the video — is usually caused by an encoding mismatch in the media file, hardware acceleration issues, or VLC's buffer settings.
Most fixes take under 30 seconds using VLC's built-in keyboard shortcuts or sync controls.
If your video file itself is corrupted, Ritridata can help recover the original file.

Read Article →

Virtual Disk Manager 'Incorrect Function' Error — 7 Fixes That Work in 2026

The 'Virtual Disk Manager: Incorrect function' error appears when Windows Disk Management or DiskPart cannot perform a disk operation — typically initialization, formatting, or attaching a VHD.
Common causes include write protection, file system incompatibility, and driver conflicts.
Ritridata can recover data from affected drives before you attempt destructive fixes.

Read Article →
Ritridata Logo
Ritridata

Professional data recovery software trusted by millions worldwide.

Products
  • Data Recovery for Windows
  • Data Recovery for Mac
Features
  • Hard Drive Recovery
  • SD Card Recovery
  • External Drive Recovery
  • Crashed System Recovery
  • Disk Image Recovery
  • Mac File Recovery
  • Recycle Bin Recovery
Legal
  • Privacy Policy
  • Terms of Service
  • Refund Policy
Support
  • Contact Us

© 2026 RitriData. All rights reserved.