🚧 Under construction — VoTechWorks is being built. A free tech program — complimentary, as our commitment to get America working.
voTechWorksGrade 13 · a vocational technology learning center, by urbanicity
newSchoolWorks.com › VoTechWorks › Technology & Design › Data Management / Database Administration › Database Backup and Recovery › Lesson 5
TEC-DATA86-04 · Lesson 5 · 12 clock hours · lab

SQL Server Backups and Azure Backup for Azure SQL (DP-300 Focus)

Objective. Students will perform full, differential, and transaction-log backups of a SQL Server database using T-SQL and configure automated backups for an Azure SQL Database, mapping each task to the DP-300 exam objective area.

⚠ Pending professional review

This lesson, its worked examples and its practice questions has not yet been verified by an industry-certified professional or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.

VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.

SQL Server Backups and Azure Backup for Azure SQL

Why Backup Strategy Matters

A database backup is the last line of defense against data loss caused by hardware failure, human error, ransomware, or software bugs. For the DP-300 exam and in real production work, you must understand the three core SQL Server backup types, how they interact, and how Azure SQL Database automates much of this process.

The Three Core Backup Types

Full backup captures the entire database — every data page and enough of the transaction log to make the backup consistent. It is the foundation of every recovery strategy. Without a recent full backup, differential and log backups are useless.

Differential backup captures only the data pages that changed since the most recent full backup. Differentials grow over time until the next full backup resets the baseline. They speed up restore time compared to replaying many log backups.

Transaction-log backup captures the log records written since the last log backup (or full/differential backup). Log backups are only possible when the database uses the Full or Bulk-Logged recovery model. They enable point-in-time recovery (PITR) — restoring a database to a precise moment rather than just the end of the last backup.

The Simple recovery model does not support log backups and therefore does not support PITR. Always confirm the recovery model before designing a backup schedule.

T-SQL Backup Syntax

Backup commands follow a consistent pattern:

```sql

-- Full backup

BACKUP DATABASE [AdventureWorks]

TO DISK = 'C:\Backups\AW_Full.bak'

WITH NAME = 'AW-Full-20250101', STATS = 10;

-- Differential backup

BACKUP DATABASE [AdventureWorks]

TO DISK = 'C:\Backups\AW_Diff.bak'

WITH DIFFERENTIAL, NAME = 'AW-Diff-20250101', STATS = 10;

-- Transaction-log backup

BACKUP LOG [AdventureWorks]

TO DISK = 'C:\Backups\AW_Log.bak'

WITH NAME = 'AW-Log-20250101', STATS = 10;

```

The `STATS = 10` option prints a progress message every 10 percent — useful for large databases. Always record the backup file path, the backup set name, and the completion time in your lab log.

Verifying a Backup

A backup file that cannot be read is worthless. SQL Server provides `RESTORE VERIFYONLY` to check that a backup set is readable and internally consistent without actually restoring data:

```sql

RESTORE VERIFYONLY

FROM DISK = 'C:\Backups\AW_Full.bak';

```

If the command returns "The backup set on file 1 is valid," the file is structurally sound. This step maps directly to the DP-300 objective area "Monitor and optimize operational resources." Make it a habit after every backup.

Point-in-Time Restore

To restore a database to a specific moment, you apply a full backup, optionally a differential, and then one or more log backups, using `WITH NORECOVERY` on all steps except the last:

```sql

-- Step 1: Restore full backup, leave DB in restoring state

RESTORE DATABASE [AW_Restore]

FROM DISK = 'C:\Backups\AW_Full.bak'

WITH NORECOVERY, MOVE 'AdventureWorks_Data'

TO 'C:\Data\AW_Restore.mdf',

MOVE 'AdventureWorks_Log'

TO 'C:\Data\AW_Restore_log.ldf';

-- Step 2: Apply log backup, stop at target time

RESTORE LOG [AW_Restore]

FROM DISK = 'C:\Backups\AW_Log.bak'

WITH STOPAT = '2025-01-01T14:30:00', RECOVERY;

```

After the final step the database comes online. A `SELECT` query should confirm that rows inserted after the target timestamp do not appear.

Azure SQL Database Automated Backups

Azure SQL Database handles backups automatically, removing the need for manual T-SQL scheduling. The platform takes full, differential, and transaction-log backups on your behalf and stores them in geo-redundant Azure Blob Storage. Key settings you can review and configure include:

These settings are visible in the Azure portal under your SQL Database resource, or configurable through Azure CLI and PowerShell. The DP-300 exam tests your ability to interpret and adjust these settings.

Safety and Good Practices

Backup files can contain sensitive personal and financial data. Treat them as carefully as the live database:

Key terms10

Full BackupA backup of the complete database, including all data pages and enough transaction log to ensure a consistent restore point; the required baseline for all other backup types.
Differential BackupA backup that captures only the data pages modified since the most recent full backup, reducing backup size and speeding up restore compared to using many log backups.
Transaction-Log BackupA backup of the transaction log records written since the last log or full/differential backup; requires Full or Bulk-Logged recovery model and enables point-in-time recovery.
Recovery ModelA SQL Server database property (Simple, Full, or Bulk-Logged) that controls how transactions are logged and which backup types are available; only Full and Bulk-Logged allow log backups.
RESTORE VERIFYONLYA T-SQL command that reads and validates a backup file's structure and checksum without restoring the database, confirming the backup is usable before a real disaster occurs.
Point-in-Time Recovery (PITR)The ability to restore a database to a precise timestamp by replaying transaction-log backups up to that moment, using the STOPAT option in a RESTORE LOG statement.
Short-Term Retention (STR)An Azure SQL Database setting that defines how many days of automated backups are retained for self-service point-in-time restore operations.
Long-Term Retention (LTR)An Azure SQL Database feature that preserves full backup snapshots for weeks, months, or years beyond the short-term window, typically for regulatory or compliance requirements.
NORECOVERYA RESTORE option that leaves the database in a restoring state after a backup is applied, allowing additional differential or log backups to be applied in sequence before bringing the database online.
Backup Storage RedundancyThe Azure setting that determines how backup data is replicated: locally redundant (single region), zone-redundant (multiple availability zones), or geo-redundant (paired region).
In class: Use T-SQL BACKUP DATABASE and BACKUP LOG statements to create a full backup, then a differential backup, then a transaction-log backup; store each to a named backup device and verify with RESTORE VERIFYONLY; annotate each statement with the corresponding DP-300 exam topic. · Restore the database to a point in time using RESTORE DATABASE WITH STOPAT and a transaction-log backup; confirm through a SELECT query that data inserted after the target time is absent. · In the Azure portal or using Azure CLI, review the automated backup settings for a provided Azure SQL Database (backup frequency, short-term retention, long-term retention options); document findings in a comparison table alongside on-premises SQL Server backup options.
Materials: SQL Server Express or Developer Edition on lab workstation; SQL Server Management Studio (SSMS) or Azure Data Studio; Azure free-tier or student subscription; Microsoft Learn DP-300 study path; T-SQL reference (learn.microsoft.com); lab log template
Check: Lab log reviewed by instructor for correct T-SQL syntax, VERIFYONLY confirmation, successful PITR restore, and the Azure comparison table; 80% rubric score required.

Practice check8

Answer each question, then check it. Nothing is recorded; this is your own practice.

DP-300: Implement a backup and recovery strategy
1. A SQL Server database is set to the Simple recovery model. A DBA attempts to run BACKUP LOG against it. What will happen?
DP-300: Implement a backup and recovery strategy
2. After taking a full backup and two transaction-log backups of the AdventureWorks database, a DBA wants to restore it to a point 20 minutes before the current time. Which T-SQL option targets that specific moment?
DP-300: Monitor and optimize operational resources
3. A DBA runs RESTORE VERIFYONLY on a backup file and receives the message 'The backup set on file 1 is valid.' What does this confirm?
DP-300: Implement a backup and recovery strategy
4. When applying a sequence of backups for a PITR restore, all steps except the final one should use which option?
DP-300: Implement a backup and recovery strategy
5. An Azure SQL Database has its short-term retention set to the default value. How many days of automated backups are available for self-service point-in-time restore?
DP-300: Implement a backup and recovery strategy
6. A company must retain full database backups for five years to satisfy a compliance audit. Which Azure SQL Database feature supports this requirement beyond the short-term retention window?
DP-300: Implement a backup and recovery strategy
7. A DBA needs to minimize data loss exposure and wants backups that can be applied quickly to reduce restore time. Which combination best achieves both goals for an on-premises SQL Server?
DP-300: Implement a backup and recovery strategy
8. Which best practice reduces the risk that a single storage failure destroys both the live database and its backup?
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.