Web Analytics Made Easy - Statcounter
Home » Database Administration » SQL Server Backup & Restore: Best Practices, Common Mistakes & Recovery Testing

SQL Server Backup & Restore: Best Practices, Common Mistakes & Recovery Testing

Sql Server Backup Restore Cheat Sheet
SQL Server Backup & Restore: Best Practices, Common Mistakes & Recovery Testing

Introduction

The Backup That Saved Us

A few years ago, I came into the office for the morning shift and found out that a very important table had been accidentally dropped during the night.

The table contained millions of rows of sensor data collected from a client’s site.

It was one of those situations every DBA hopes never happens.

Fortunately, we had a scheduled backup strategy in place, and more importantly, we regularly tested our backups by restoring them.

We have Full recovery model

That meant we weren’t sitting there wondering, “I hope the backup worked.”

We knew which backups were available, we knew the restore process worked, and we could perform a point-in-time recovery to recover the database to the required state.

The incident reinforced something I have never forgotten:

A successful backup job is not the same thing as a successful recovery strategy.

Why Do We Need to Test Database Restoration Regularly?

Most of us create a scheduled database backup job, check that it runs successfully, and then move on to the next DBA task.

The problem is that database recovery is usually not tested as frequently as database backup.

We often discover the difference only when something goes wrong like a table is accidentally dropped, important data is deleted, a database becomes corrupted, or a server becomes unavailable.

At that moment, the question changes from:

“Did the backup job run?”

to:

“Can I actually recover the data I need, within the required time?”

That’s when an untested backup strategy can become a very serious problem.

A reliable backup strategy is one of the most important responsibilities of a SQL Server DBA.

But taking a backup is only half the job.

The real question is:

Can you restore the database successfully when you actually need it?

A good backup and restore strategy should consider recovery model, backup types, RPO, RTO, backup retention, storage, permissions, encryption, restore testing and the correct restore sequence.

This cheat sheet provides a practical quick reference for everyday SQL Server DBA work.

Before You Start

ItemDetails
SQL ServerSQL Server 2019, 2022 and later
Azure SQL DatabaseBackup/restore architecture is different; don’t apply these T-SQL commands directly
Azure SQL Managed InstanceMany SQL Server backup/restore concepts apply
Main toolsSSMS, T-SQL, SQL Server Agent, monitoring/backup tools
Backup filesCommonly .bak for database backups and .trn for transaction-log backups
Production cautionAlways test restores; a successful backup does not prove recoverability

SQL Server supports full, differential, transaction-log, copy-only, file/filegroup and partial backups. The recovery model determines which backup and restore operations are available.

SQL Server Version & Permission Requirements

Permissions are an important part of backup and restore operations and should be checked before starting a production activity.

For backup operations, SQL Server permissions depend on the database and operation being performed. Avoid granting excessive privileges simply because someone needs to perform a backup.

For restore operations, permissions are more restrictive. If the target database doesn’t exist, CREATE DATABASE permission is required to execute the restore. When restoring an existing database, RESTORE permissions are normally available to sysadmin, dbcreator, and the database owner (dbo). Membership in db_owner alone does not automatically provide RESTORE permission because the database might not be accessible when a restore is being performed.

For backup inspection commands such as:

RESTORE HEADERONLY
RESTORE FILELISTONLY
RESTORE VERIFYONLY

SQL Server requires CREATE DATABASE permission because these commands can expose information about backup contents.

Production Tip: If you don’t have the required permission, involve the DBA/database security team rather than requesting sysadmin just to perform a backup or restore task.

1. SQL Server Recovery Models

SQL Server has three recovery models:

Recovery ModelLog BackupPoint-in-Time RecoveryTypical Use
SimpleNONODatabases where limited recovery requirements are acceptable
FullYESYESProduction databases requiring granular recovery
Bulk-loggedYESLimitedSpecial bulk-operation scenarios

Check the recovery model

SELECT
    name,
    recovery_model_desc
FROM sys.databases
WHERE name = 'MyDatabase';

The recovery model controls transaction-log maintenance and the backup/restore options available for the database.

Please Note

If a database is in Full recovery model, regular transaction-log backups are required. Otherwise, the transaction log can continue to grow.

If you switch from Simple to Full recovery model, take a full database backup to establish the required backup chain before relying on log backups for recovery.

2. Full Database Backup

A full backup contains the database data required to restore the database to the point represented by that backup.

BACKUP DATABASE MyDatabase
TO DISK = 'D:\SQLBackup\MyDatabase_FULL.bak'
WITH
    COMPRESSION,
    CHECKSUM,
    STATS = 10;

A full backup is the foundation for many restore strategies.

3. Differential Backup

A differential backup contains changes made since the most recent full backup that serves as its differential base.

BACKUP DATABASE MyDatabase
TO DISK = 'D:\SQLBackup\MyDatabase_DIFF.bak'
WITH
    DIFFERENTIAL,
    COMPRESSION,
    CHECKSUM,
    STATS = 10;

Typical restore sequence:

Full Backup
     ↓
Latest Differential Backup
     ↓
Subsequent Log Backups

You don’t restore every differential backup between the full backup and the recovery point. You normally restore the latest required differential and then the applicable transaction-log backups.

4. Transaction Log Backup

Transaction-log backups are available for databases using the Full or Bulk-logged recovery model.

BACKUP LOG MyDatabase
TO DISK = 'D:\SQLBackup\MyDatabase_20261003_1800.trn'
WITH
    COMPRESSION,
    CHECKSUM,
    STATS = 10;

Log backups capture log records that haven’t already been backed up.

A common production strategy might look like:

FULL
  ↓
LOG
  ↓
LOG
  ↓
LOG
  ↓
LOG

The actual frequency should be based on your RPO and workload, not simply an arbitrary schedule.

5. Copy-Only Backup

A copy-only backup is useful when you need an independent backup without affecting the normal backup sequence.

BACKUP DATABASE MyDatabase
TO DISK = 'D:\SQLBackup\MyDatabase_COPYONLY.bak'
WITH
    COPY_ONLY,
    COMPRESSION,
    CHECKSUM;

For example, you may need a one-time copy of a production database for another purpose but don’t want that backup to become part of your normal differential strategy.

6. Check Existing Backup History

SQL Server stores backup history in msdb.

SELECT
    database_name,
    backup_start_date,
    backup_finish_date,
    type,
    backup_size,
    compressed_backup_size,
    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 database_name = 'MyDatabase'
ORDER BY backup_finish_date DESC;

Backup type values commonly include:

D = Full
I = Differential
L = Transaction Log

This is extremely useful when investigating:

“When was the last successful full backup?”

or:

“Do we have the log backups required for recovery?”

7. Verify a Backup

You can use:

RESTORE VERIFYONLY
FROM DISK = 'D:\SQLBackup\MyDatabase_FULL.bak';

But remember:

RESTORE VERIFYONLY is not the same as performing a test restore.

It checks whether the backup set is complete and readable, but it does not actually restore the database or validate the complete database structure.

The strongest validation is a real restore to a test environment.

8. Inspect Backup Contents

Before restoring an unfamiliar backup, you can inspect its metadata.

View backup header

RESTORE HEADERONLY
FROM DISK = 'D:\SQLBackup\MyDatabase_FULL.bak';

View database files

RESTORE FILELISTONLY
FROM DISK = 'D:\SQLBackup\MyDatabase_FULL.bak';

RESTORE FILELISTONLY is particularly useful when restoring a database to different file locations.

9. Basic Full Database Restore

RESTORE DATABASE MyDatabase
FROM DISK = 'D:\SQLBackup\MyDatabase_FULL.bak'
WITH
    RECOVERY,
    STATS = 10;

RECOVERY makes the database available after the restore sequence is complete.

If you have additional differential or log backups to restore, use NORECOVERY instead.

10. Restore Full + Differential

Suppose you have:

Full Backup       01:00
Differential      12:00
Log               12:15
Log               12:30
Log               12:45

Restore:

RESTORE DATABASE MyDatabase
FROM DISK = 'D:\SQLBackup\MyDatabase_FULL.bak'
WITH NORECOVERY;

Then:

RESTORE DATABASE MyDatabase
FROM DISK = 'D:\SQLBackup\MyDatabase_DIFF.bak'
WITH NORECOVERY;

Then restore the required log backups in sequence.

Finally:

RESTORE DATABASE MyDatabase
WITH RECOVERY;

11. Full + Log Restore Sequence

For a Full recovery-model database:

FULL
 ↓
DIFFERENTIAL (optional)
 ↓
LOG 1
 ↓
LOG 2
 ↓
LOG 3
 ↓
RECOVERY

All required log backups must be restored in the correct sequence.

You cannot normally skip an applicable log backup in the chain and continue with a later one.

12. NORECOVERY vs RECOVERY

This is one of the most important concepts in SQL Server restore operations.

WITH NORECOVERY

Use when:

More backups still need to be restored.

Example:

RESTORE DATABASE MyDatabase
FROM DISK = 'D:\SQLBackup\MyDatabase_FULL.bak'
WITH NORECOVERY;

The database remains in a restoring state.

WITH RECOVERY

Use when:

The restore sequence is complete.

RESTORE DATABASE MyDatabase
WITH RECOVERY;

Once you recover the database, you generally cannot continue applying additional backups to that restore sequence.

13. Point-in-Time Recovery

One of the biggest advantages of the Full recovery model is the ability to restore to a specific point in time, assuming the required backup chain is available.

For example:

A user accidentally deleted important data at 14:32.

You may want to restore to:

14:31:59

Example:

RESTORE LOG MyDatabase
FROM DISK = 'D:\SQLBackup\MyDatabase_1430.trn'
WITH
    STOPAT = '2026-10-03 14:31:59',
    RECOVERY;

The exact restore sequence depends on your full, differential and log backups.

14. Tail-Log Backup

If the database is damaged and you’re attempting to recover as much data as possible, consider whether a tail-log backup can be taken before beginning the restore.

Conceptually:

Existing backups
      ↓
Tail-log backup
      ↓
Restore sequence
      ↓
Recover

Whether a tail-log backup is possible depends on the failure scenario and availability of the database/log files. Microsoft recommends considering the tail of the log before restoring a database under Full or Bulk-logged recovery when appropriate.

15. Restore to a Different Server or Location

When restoring to another server, check the logical file names first:

RESTORE FILELISTONLY
FROM DISK = 'D:\SQLBackup\MyDatabase_FULL.bak';

Then use MOVE:

RESTORE DATABASE MyDatabase
FROM DISK = 'D:\SQLBackup\MyDatabase_FULL.bak'
WITH
    MOVE 'MyDatabase'
        TO 'E:\SQLData\MyDatabase.mdf',
    MOVE 'MyDatabase_log'
        TO 'F:\SQLLogs\MyDatabase_log.ldf',
    RECOVERY,
    STATS = 10;

The logical file names in the MOVE clauses must match the logical names contained in the backup.

16. Backup Compression

Compression can significantly reduce backup size and I/O requirements, although it consumes CPU.

BACKUP DATABASE MyDatabase
TO DISK = 'D:\SQLBackup\MyDatabase.bak'
WITH COMPRESSION;

Don’t assume compression is always “free.” On a CPU-constrained production server, evaluate the CPU overhead and backup window.

17. Backup Checksums

You can request backup checksums:

BACKUP DATABASE MyDatabase
TO DISK = 'D:\SQLBackup\MyDatabase.bak'
WITH CHECKSUM;

You can also use checksum validation during restore operations.

The goal is to detect certain forms of corruption during the backup/restore process rather than assuming the backup is automatically perfect.

18. Backup Storage Best Practice

Don’t store your only backup copy on the same physical storage as the database.

For example:

SQL Data
   ↓
D:\SQLData

Backup
   ↓
D:\SQLBackup

isn’t necessarily enough protection if both are dependent on the same physical storage failure.

Prefer appropriately separated storage and maintain off-server/off-site copies according to your organization’s disaster-recovery requirements.

Microsoft specifically recommends storing backups separately from the database files and maintaining safe/off-site copies as appropriate.

19. Backup Encryption

Backups may contain sensitive production information.

Consider backup encryption when required by your security and compliance requirements.

If an encrypted database/backup depends on certificates or asymmetric keys, protect and retain those keys for as long as the backup needs to remain restorable.

Losing the encryption key can make an otherwise valid backup unusable.

20. Recovery Point Objective vs Recovery Time Objective

Backup frequency should be driven by business requirements.

RPO – Recovery Point Objective

How much data can the business afford to lose?

For example:

RPO = 15 minutes

You need a recovery strategy capable of meeting that requirement.

RTO – Recovery Time Objective

How quickly must the application/database be restored?

For example:

RTO = 1 hour

Having a backup that takes six hours to restore doesn’t meet a one-hour RTO.

Your backup strategy should therefore be designed around both RPO and RTO.

21. Common Backup Mistakes

“The backup job completed successfully, so we are protected.”

Not necessarily.

Test restores.

Keeping backups only on the database server

A server/storage failure can affect both the database and backup.

Using Full recovery without regular log backups

The transaction log can continue growing.

Never testing point-in-time recovery

Having log backups doesn’t automatically mean your recovery process will work.

Deleting old backups without understanding the recovery chain

Retention must be designed around your recovery requirements.

Giving everyone sysadmin

Use the minimum permissions required for the operation.

Forgetting encryption keys

An encrypted backup may be unusable without the required certificate/asymmetric key.

Assuming RESTORE VERIFYONLY proves recoverability

It doesn’t replace a real restore test.

22. The Most Important Backup Rule

I would summarize the entire cheat sheet with this:

Backup is not the goal. Recovery is the goal.

A successful backup job only tells you that a backup operation completed.

A successful restore test tells you much more.

You should know:

What do we back up?
        ↓
How often?
        ↓
Where are backups stored?
        ↓
How long are they retained?
        ↓
Can we restore them?
        ↓
How long does restore take?
        ↓
Can we meet the RPO/RTO?

23. Practical Backup Strategy Example

A possible production strategy might look like:

Sunday
   ↓
FULL BACKUP

Monday–Saturday
   ↓
DIFFERENTIAL BACKUPS

Every 15 minutes
   ↓
TRANSACTION LOG BACKUPS

But this is only an example, not a universal recommendation.

The actual schedule should depend on:

  • Database size
  • Transaction volume
  • RPO
  • RTO
  • Backup window
  • Storage capacity
  • Network bandwidth
  • Business requirements
  • Restore time
  • Retention requirements

24. Quick DBA Backup & Restore Reference

RequirementCommand / Concept
Full backupBACKUP DATABASE
Differential backupWITH DIFFERENTIAL
Log backupBACKUP LOG
Copy-only backupWITH COPY_ONLY
CompressionWITH COMPRESSION
Backup checksumWITH CHECKSUM
Check recovery modelsys.databases
Verify backupRESTORE VERIFYONLY
View backup headerRESTORE HEADERONLY
View backup filesRESTORE FILELISTONLY
Restore databaseRESTORE DATABASE
Restore logRESTORE LOG
Continue restore sequenceWITH NORECOVERY
Finish restoreWITH RECOVERY
Point-in-time restoreSTOPAT
Move database filesWITH MOVE
Backup historymsdb.dbo.backupset

25. Backup & Restore Troubleshooting Flow

Need to recover database
        ↓
Identify recovery objective
        ↓
Check recovery model
        ↓
Identify latest valid FULL backup
        ↓
Identify latest applicable DIFFERENTIAL
        ↓
Identify required LOG backups
        ↓
Check backup chain
        ↓
Check backup accessibility
        ↓
Check required permissions
        ↓
Restore FULL
        ↓
Restore DIFFERENTIAL (if applicable)
        ↓
Restore LOG backups in sequence
        ↓
STOPAT if required
        ↓
WITH RECOVERY
        ↓
Validate database
        ↓
Validate application

Final DBA Checklist

Before saying “our database is protected,” make sure you can answer:

  • What recovery model is the database using?
  • When was the last successful full backup?
  • When was the last differential backup?
  • When was the last successful log backup?
  • Is the log backup chain intact?
  • Where are the backups stored?
  • Are backups protected from server/storage failure?
  • Are backups encrypted where required?
  • Are encryption certificates/keys safely retained?
  • How long are backups retained?
  • Have we actually performed a test restore?
  • How long does the restore take?
  • Can we meet our RPO?
  • Can we meet our RTO?
  • Does the person performing the restore have the required permissions?
  • Is the restore procedure documented?

Summary

For a DBA, backup is not simply a scheduled SQL Server Agent job showing “Success.”

The real test comes when someone says:

“We need the database back. Now.”

At that moment, you need more than a .bak file.

You need a tested recovery strategy, a known backup chain, the required permissions, access to the required encryption keys, and a documented restore process.

That’s why one of the most important DBA habits is:

Don’t just verify that your backups are running. Regularly prove that you can restore them.

Microsoft similarly recommends testing restore procedures and maintaining backups in safe, appropriately separated locations as part of a backup and restore strategy.

TechMixing Production Tip: Treat backup and restore as two sides of the same process. A backup that has never been successfully restored is an assumption about recoverability, not proof of it.


Discover more from Technology with Vivek Johari

Subscribe to get the latest posts sent to your email.

Leave a Reply

Scroll to Top

Discover more from Technology with Vivek Johari

Subscribe now to keep reading and get access to the full archive.

Continue reading