SQL Server Agent, Backup and Restore: Two Practical Guides for DBAs

2026-07-27 · 8 min

As a SQL Server administrator, it is easy to assume a process is working correctly because its status is green.

The job ran. The backup completed. SQL Server Agent reported no error. Everything looks fine at first glance.

But a green status answers only one question:

Did SQL Server Agent consider the job successful?

It does not tell us whether:

  • the process completed every expected action,
  • the job ran in the correct security context,
  • error notifications will reach the DBA team,
  • the job will work after failover or migration,
  • the backup can be restored,
  • the restore will meet the required RTO,
  • potential data loss meets the RPO.

Those questions inspired two practical guides for SQL Server administrators.

Two Areas, One DBA Responsibility

The first guide concerns automation:

SQL Server Agent — Practical DBA Package

The second focuses on data protection and disaster readiness:

SQL Server Backup and Restore — Practical DBA Guide

They share a principle:

Configuring a process does not automatically make it safe.

Automation must be monitored, documented, and diagnosable. Backups must be restorable, tested, and aligned with RPO and RTO.

SQL Server Agent Is More Than a Scheduler

SQL Server Agent is often treated as a simple scheduler: create a job, add steps, choose a start time, and check execution history.

In production, it is a much more important automation layer. It can run:

  • backups and database integrity checks,
  • ETL processes and SSIS packages,
  • PowerShell scripts,
  • data imports and exports,
  • reports and maintenance tasks,
  • business-calendar-dependent operations,
  • monitoring procedures.

A failure or misconfiguration can therefore affect multiple systems simultaneously.

A Green Job Does Not Always Mean the Process Succeeded

Imagine a multistep job:

1
2
3
4
Krok 1: przygotowanie danych
Krok 2: eksport pliku
Krok 3: wysłanie pliku do systemu zewnętrznego
Krok 4: zapis informacji o zakończeniu procesu

If step 2 fails but the job’s step-transition configuration allows it to reach the final step and report success, the history may still show green.

Technically, the job finished. From the business perspective, the process failed.

When designing jobs, verify:

  • actions on success and failure,
  • script exit codes,
  • exception handling,
  • retry attempts and retry interval,
  • timeouts,
  • result logging,
  • notifications,
  • dependencies between steps.

Example of explicitly raising an error in a T-SQL step:

1
2
3
4
5
6
7
8
BEGIN TRY
    EXEC dbo.usp_ProcessDailyData;
END TRY
BEGIN CATCH
    DECLARE @ErrorMessage nvarchar(2048) = ERROR_MESSAGE();

    THROW 51000, @ErrorMessage, 1;
END CATCH;

If the expected work did not complete, the step should fail in a way SQL Server Agent can record.

What the SQL Server Agent Guide Covers

SQL Server Agent — Practical DBA Package covers the full job lifecycle:

  • designing jobs and steps,
  • T-SQL, PowerShell, CmdExec and SSIS steps,
  • schedules, retries, timeouts and error handling,
  • Database Mail, operators and alerts,
  • security and msdb roles,
  • Credentials and Proxies,
  • backup jobs and execution monitoring,
  • change auditing and business-day calendars,
  • patching preparation and SQL Server Agent on FCI,
  • SSISDB diagnostics and troubleshooting,
  • emergency runbooks and job documentation,
  • environment migrations and DBA reports,
  • a production SQL Server Agent baseline.

It also includes checklists, monitoring scripts, documentation templates, and procedures you can adapt.

Free Preview — SQL Server Agent

I do not want anyone buying a product without knowing what is inside.

The free preview contains the cover, full table of contents, a sample chapter, selected scripts and checklists, and information about the complete version.

Download the free SQL Server Agent preview

Buy the complete SQL Server Agent guide — PLN 119

Backup Is Not a Strategy

The second guide starts from a simple premise:

Backup is not an end in itself.

A backup is a means to restore data and system operations after failure, user error, database corruption, server or storage loss, or a security incident.

The question:

1
Czy backup się wykonał?

is only the beginning. The real question is:

1
2
Czy potrafię odtworzyć bazę do właściwego punktu w czasie
i w czasie akceptowalnym dla organizacji?

RPO and RTO Come First

A backup strategy must follow business requirements:

  • RPO — maximum acceptable data loss.
  • RTO — maximum acceptable time to restore service.

If RPO is 15 minutes, hourly LOG backups are not enough. If RTO is two hours but restoring the database takes six, having a valid backup is not sufficient.

A DBA should measure more than backup duration:

  • file transfer time,
  • restore and recovery time,
  • integrity-check duration,
  • time to restore logins and dependencies,
  • application startup time after recovery.

FULL, DIFF and LOG Form a Recovery Plan

A common production strategy is:

1
FULL + DIFF + LOG

For example:

1
2
3
4
5
6
20:00 FULL backup
22:00 DIFF backup
22:15 LOG backup
22:30 LOG backup
22:45 LOG backup
23:00 LOG backup

If an incident occurs at 22:40, recovery may require:

  1. the correct FULL backup,
  2. the appropriate DIFF backup,
  3. subsequent LOG backups,
  4. a final restore using STOPAT.

Example:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
RESTORE DATABASE [ERP_Restore]
FROM DISK = N'X:\Backup\ERP\ERP_FULL.bak'
WITH
    NORECOVERY,
    CHECKSUM,
    STATS = 10;
GO

RESTORE DATABASE [ERP_Restore]
FROM DISK = N'X:\Backup\ERP\ERP_DIFF.bak'
WITH
    NORECOVERY,
    CHECKSUM,
    STATS = 10;
GO

RESTORE LOG [ERP_Restore]
FROM DISK = N'X:\Backup\ERP\ERP_LOG_001.trn'
WITH
    NORECOVERY,
    CHECKSUM,
    STATS = 10;
GO

RESTORE LOG [ERP_Restore]
FROM DISK = N'X:\Backup\ERP\ERP_LOG_LAST.trn'
WITH
    STOPAT = '2026-07-28T22:39:59',
    RECOVERY,
    CHECKSUM,
    STATS = 10;
GO

Having the files is not enough. We must know which files to use, their order, whether the LOG chain is complete, whether all files are accessible, and whether the necessary encryption certificates exist.

TDE and Certificates

For Transparent Data Encryption, restoring a database backup on another instance also requires the appropriate TDE certificate and key material.

This may include:

  • the certificate,
  • its private key,
  • the password protecting the exported key,
  • an off-server copy of the certificate,
  • a documented import procedure for another instance.

A backup may be valid but unusable elsewhere without the certificate. Certificates belong in the Disaster Recovery plan, not in a private folder on an old server.

RESTORE VERIFYONLY Is Not a Full Test

This command is useful:

1
2
3
RESTORE VERIFYONLY
FROM DISK = N'X:\Backup\ERP\ERP_FULL.bak'
WITH CHECKSUM;

But it does not replace an actual restore test. It does not prove that:

  • the complete FULL/DIFF/LOG sequence will restore,
  • every striped backup file is available,
  • the TDE certificate is accessible,
  • the file paths are correct,
  • the restored database passes DBCC CHECKDB,
  • the application works,
  • the procedure meets RTO.

A real backup test means restoring the database.

What the Backup and Restore Guide Covers

SQL Server Backup and Restore — Practical DBA Guide covers:

  • RPO and RTO,
  • FULL, DIFF, LOG, COPY_ONLY and filegroup backups,
  • recovery models, LSNs and the log chain,
  • point-in-time restore and environment-specific strategies,
  • VLDBs and large database recovery,
  • COMPRESSION, CHECKSUM, MAXTRANSFERSIZE, BUFFERCOUNT,
  • striped backups, capacity planning and retention,
  • TDE, backup encryption, certificates and keys,
  • least privilege, gMSA, SPN and Kerberos,
  • backup monitoring and operational alerts,
  • automated restore tests and post-restore DBCC CHECKDB,
  • tail-log backups and emergency procedures,
  • ransomware scenarios, restore runbooks and incident documentation.

The guide is not only about command syntax. It explains how to build a complete, testable operational standard.

Free Preview — Backup and Restore

The free preview includes the cover, complete table of contents, introduction, the chapter “Backup Is Not a Strategy,” RPO/RTO discussion, and basic SQL Server backup types.

Download the free Backup and Restore preview

Buy the complete Backup and Restore guide — PLN 119

Who Are These Guides For?

Both publications are designed primarily for SQL Server administrators, Windows administrators maintaining database environments, people responsible for backups and ETL, developers supporting production systems, those building operational standards, trainers, and junior DBAs learning production discipline.

These are not scripts to copy blindly into production.

Test each script in a lab first, then adapt it to your SQL Server version, security model, service accounts, storage layout, schedules, organizational standards, and actual RPO/RTO requirements.

Two Guides, One DBA Standard

SQL Server Agent — Practical DBA Package answers:

How do we design, monitor, and control SQL Server automation?

SQL Server Backup and Restore — Practical DBA Guide answers:

How do we prepare for a real failure and recover data successfully?

Together they provide a structured foundation for everyday DBA work.

A calm DBA does not assume the process will work. A calm DBA verifies, monitors, documents, tests, and prepares procedures for when something goes wrong.

Complete Editions

SQL Server Agent — Practical DBA Package

Automation, monitoring, security, troubleshooting, SSIS, patching, failover, runbooks, and DBA reports.

Buy the publication — PLN 119

SQL Server Backup and Restore — Practical DBA Guide

RPO, RTO, LSN, log chains, TDE, monitoring, restore testing, emergency procedures, and Disaster Recovery.

Buy the publication — PLN 119


If your environment has green jobs today, ask yourself two questions:

Do you know what happens after the first process error?

And:

When did you last actually restore a database from backup?


Tags: SQLServer , SQLServerAgent , Backup , Restore , DBA , DisasterRecovery

Marcin Pytlik
LinkedIn · GitHub

Marcin Pytlik

LinkedIn · GitHub