SQL Server Backup and Restore: Recovery Models, Full, Differential and Log Backups

SQL Server 6 min readUpdated Nov 20, 2026
6 views0 comments

A backup you never tested is only a hope. This guide explains the recovery models (SIMPLE, FULL and BULK_LOGGED), shows how to take full, differential and transaction log backups, how to restore a database step by step with NORECOVERY and RECOVERY, and how to go back to one exact minute with STOPAT.

Part of the SQL Server for Beginners series. This article is the written version of lesson 12 of the Bigland Network video course, with the same sample data. The results shown were worked out by hand from that data, so run every example on a test database, not on production data.

Watch lesson 12 as a video or open it on YouTube. The written lesson below follows the same steps and the same sample data.


Contents

1. Why backups matter

  • Mistakes: someone runs DELETE without a WHERE clause.
  • Failures: a disk or a whole server dies.
  • Attacks: ransomware or a bad update.
  • The rule: no tested backup means no safety.

2. The three recovery models

Every database has a recovery model. It decides how the transaction log is kept.

Model Meaning
SIMPLE No log backups. You can lose all work since the last backup.
FULL Log backups allowed. You can restore to any minute.
BULK_LOGGED Like FULL, but big loads are logged lightly

For real company data, FULL is the usual choice. Check and change the model like this:

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

ALTER DATABASE CompanyDB
    SET RECOVERY FULL;
name recovery_model_desc
CompanyDB FULL

After you switch to FULL, take a full backup. The log backups start working only after that.

3. Full backup and its options

BACKUP DATABASE CompanyDB
    TO DISK = 'D:\Backup\CompanyDB_full.bak'
    WITH COMPRESSION, CHECKSUM, INIT;
  • A full backup copies the whole database. It is the base of every restore.
  • COMPRESSION makes the file smaller, CHECKSUM detects damage early, INIT overwrites the old file with the same name.

4. Differential and log backups

BACKUP DATABASE CompanyDB
    TO DISK = 'D:\Backup\CompanyDB_diff.bak'
    WITH DIFFERENTIAL;

BACKUP LOG CompanyDB
    TO DISK = 'D:\Backup\CompanyDB_log1.trn';
  • A differential backup saves only what changed since the last full backup. It is smaller and faster.
  • A log backup needs the FULL recovery model. It saves every change since the previous log backup and lets SQL Server reuse the log file. Without log backups, the log keeps growing.

5. A simple backup plan

When Backup
Sunday night One full backup
Every night One differential backup
Every 15 minutes A log backup, all day
Result You lose 15 minutes of work at most

6. Verify a backup file

RESTORE VERIFYONLY
    FROM DISK = 'D:\Backup\CompanyDB_full.bak'
    WITH CHECKSUM;

SQL Server answers that the backup set on the file is valid. This checks the file only. Only a real restore proves that you can restore.

7. Restore a database

A disaster: someone forgets the WHERE clause.

DELETE FROM Employees;

SELECT COUNT(*) AS Employees FROM Employees;
Employees
0

All six employees are gone. Restore the full backup. Switch to master first, because you cannot restore a database that you are using:

USE master;
GO
RESTORE DATABASE CompanyDB
    FROM DISK = 'D:\Backup\CompanyDB_full.bak'
    WITH REPLACE;

SELECT COUNT(*) AS Employees FROM CompanyDB.dbo.Employees;
Employees
6

Be careful with REPLACE: it overwrites the existing database.

8. Restore a chain and point in time recovery

Often you need more than one file. Use NORECOVERY on every file except the last, which gets RECOVERY:

RESTORE DATABASE CompanyDB
    FROM DISK = 'D:\Backup\CompanyDB_full.bak'
    WITH NORECOVERY, REPLACE;

RESTORE DATABASE CompanyDB
    FROM DISK = 'D:\Backup\CompanyDB_diff.bak'
    WITH NORECOVERY;

RESTORE LOG CompanyDB
    FROM DISK = 'D:\Backup\CompanyDB_log1.trn'
    WITH NORECOVERY;

RESTORE DATABASE CompanyDB WITH RECOVERY;

While NORECOVERY is active, the database stays in the Restoring state. A very common mistake is to forget the last step, WITH RECOVERY.

To go back to one exact minute, restore the log with STOPAT:

RESTORE LOG CompanyDB
    FROM DISK = 'D:\Backup\CompanyDB_log1.trn'
    WITH STOPAT = '2026-11-10 09:29:00',
         RECOVERY;

This needs the FULL recovery model and a complete chain of log backups.

9. Backup history and where to keep backups

SELECT TOP 3
    CASE type WHEN 'D' THEN 'Full'
         WHEN 'I' THEN 'Differential'
         WHEN 'L' THEN 'Log' END AS BackupType,
    backup_finish_date AS Finished
FROM msdb.dbo.backupset
WHERE database_name = 'CompanyDB'
ORDER BY backup_finish_date DESC;
BackupType Finished
Log 2026-11-10 08:15
Log 2026-11-10 08:00
Differential 2026-11-10 01:00

Keep copies by the 3-2-1 rule: three copies of your data, on two different kinds of storage, and one copy in another place or in the cloud. Restore on another server every month to test.

10. Common mistakes and best practices

  • Backups never tested with a real restore.
  • FULL recovery model but no log backups, so the log grows.
  • Backup files saved on the same disk as the database.
  • Using WITH REPLACE without thinking.
  • Forgetting WITH RECOVERY at the end of a restore.
  • Best practice: choose the model from your business need, use COMPRESSION and CHECKSUM, automate the jobs (SQL Server Agent jobs), keep copies elsewhere, practice a restore and write the steps down, and watch the backup history for failed jobs. See also How to Back Up and Restore a SQL Server Database with T-SQL.

11. Practice

  • Check the recovery model of CompanyDB, then set it to FULL.
  • Make a compressed full backup with CHECKSUM, then a log backup.
  • Restore the full backup and the log backup, and bring the database online.
SELECT name, recovery_model_desc
FROM sys.databases WHERE name = 'CompanyDB';   -- SIMPLE in our example
ALTER DATABASE CompanyDB SET RECOVERY FULL;

BACKUP DATABASE CompanyDB
    TO DISK = 'D:\Backup\CompanyDB_full.bak'
    WITH COMPRESSION, CHECKSUM, INIT;
BACKUP LOG CompanyDB
    TO DISK = 'D:\Backup\CompanyDB_log1.trn';

RESTORE DATABASE CompanyDB
    FROM DISK = 'D:\Backup\CompanyDB_full.bak'
    WITH NORECOVERY, REPLACE;
RESTORE LOG CompanyDB
    FROM DISK = 'D:\Backup\CompanyDB_log1.trn'
    WITH RECOVERY;

Frequently asked questions

Which recovery model should I use?

Use FULL for data you cannot afford to lose, together with regular log backups. SIMPLE is fine for test data that you can rebuild.

What is the difference between NORECOVERY and RECOVERY?

NORECOVERY means more backup files are coming, so the database stays in the Restoring state. RECOVERY finishes the restore and brings the database online.

Does RESTORE VERIFYONLY prove my backup works?

No. It checks that the file is readable and valid. Only a real restore on another server proves that you can recover.

What to learn next

The next lesson covers query performance tuning. Previous lesson: Lesson 11: Security: Logins, Users and Roles.

The whole series

Sources and further reading

  • Microsoft Learn, Transact-SQL reference (Database Engine), on learn.microsoft.com: the official syntax for the statements used here.
  • Microsoft Learn, SQL Server documentation, for SQL Server Management Studio (SSMS) and the sample concepts.
Did you find this helpful?Tap the heart to let us know. It takes one second and no account.

More tutorials like this

Leave a Comment

Your email address will not be published. Required fields are marked *

Bigland Network IT

Practical tutorials for people who run, build and fix things: operating systems, databases, development, networking and security.

Topics

More

Site

© 2026 Bigland Network. All rights reserved.Always test commands on a non-production system first.
Scroll to Top