Let’s Get Certified
Module 15 / 16 · Plan and configure a high availability and disaster recovery environment

Rehearse a point-in-time restore

Test backup compatibility, log continuity, final recovery and application validation.

Rehearse a point-in-time restore

Work through the decision

A full backup was taken Sunday. Wednesday’s differential is based on Sunday’s full. An operator needs Thursday at 09:14, before a mistaken change at 09:15. Are the newest files always the right files?

Check your reasoning

Choose the correct database and recovery fork, a usable full and a matching differential at or before the target, then a continuous log path from that restored state through the target time. Keep intermediate restores in NORECOVERY. Apply the last log with STOPAT and complete recovery. Validate integrity and business data in a separate restored database.

Watch the source lesson at 2:53:39

Compare the choices

Compatible restore base
Select the intended full backup and a differential based on that full where used. Verify identity, recovery fork and metadata.
Continuous log sequence
Cover the interval from the restored state through the recovery point with compatible log backups. A missing interval can block the restore.
NORECOVERY
Keep a database in the restoring state while more backups still need to be applied.
STOPAT
Specify a supported target time when applying the final log backup, then recover and validate the database.

Test the decision

For Azure SQL Database use the managed restore workflow and check available retention for the selected time. For native backups verify metadata, encryption material and storage access. A backup filename or success notification alone cannot prove recoverability.

Inspect a native backup chain

On a SQL Server instance that recorded the backups, review msdb backup history for the database and compare the headers of the available media. A differential must belong to its base and log backups must reach the requested time on a compatible recovery path. An actual restore to a separate destination tests the plan.

Microsoft Learn · point-in-time restore

Read SQL Server backup history

SELECT type, backup_start_date, backup_finish_date, first_lsn, last_lsn,
       checkpoint_lsn, differential_base_lsn, last_recovery_fork_guid
FROM msdb.dbo.backupset
WHERE database_name = N'Orders'
ORDER BY backup_finish_date;
Check the result

D, I and L identify full database, differential database and log backups. Use this history as an inventory. Check the actual backup media and encryption keys and test the restore before recording a recovery time. Managed Azure SQL Database point-in-time restore uses the service-managed restore workflow.

Practice the guide skills

  1. A database needs daily recoverability and a seven-year audit copy. Watch 2:53:39 · Continue at 2:53:59
    Check your answer

    Set point-in-time retention for operational recovery and an appropriate long-term backup retention policy for the required snapshots. Validate restores separately.

  2. For a customer-managed SQL Server backup, what should operators capture? Watch 2:55:35 · Continue at 2:55:48
    Check your answer

    Choose supported full, differential or log backups based on recovery model and objectives. Inspect backup metadata, encryption keys and storage access.

  3. Lay out the sequence for a full, differential and log restore. Watch 2:55:59 · Continue at 2:56:23
    Check your answer

    Restore the full backup with NORECOVERY, then the matching differential if used, then a continuous log sequence. Recover only on the final step.

  4. A mistaken update occurred just after 09:20. Watch 2:56:47 · Continue at 2:57:28
    Check your answer

    Choose a target immediately before the transaction and apply the required chain using STOPAT on the final native log restore. For Azure SQL Database use the managed point-in-time restore workflow to a separate database.

  5. An audit owner wants the first monthly snapshot retained for years. Watch 2:57:53 · Continue at 2:58:23
    Check your answer

    Configure an eligible long-term retention policy and document retention, region and redundancy. Confirm snapshots actually exist and test one restore.

  6. Explain the role of NORECOVERY and RECOVERY in T-SQL. Watch 2:55:48 · Continue at 2:56:23 · Continue at 2:56:47
    Check your answer

    NORECOVERY leaves a database able to accept later backups. RECOVERY completes recovery for use and ends that restore sequence.

  7. A backup is written to Azure Blob Storage. What must a recovery drill prove? Watch 2:54:50 · Continue at 2:55:52 · Continue at 43:13
    Check your answer

    Validate the supported URL backup method, authorization, network access and encryption material from the recovery host. Perform a real restore into an isolated supported environment.

Official objectives for this lesson

Lab · Select a compatible restore chain and find a missing log

Save as restore.py and run python3 restore.py. The fixtures model a native SQL Server full-recovery restore. Backup labels encode a single database and recovery fork. The target transaction at 10:17 has synthetic LSN 197. Treat each log range as start-inclusive and end-exclusive. Predict what happens when the log covering the target disappears.

full = {"id": "F1", "checkpoint": 100, "fork": "east"}
diffs = [("D1", 100, "east", 150), ("D2", 120, "west", 175)]
# label, recovery fork, first LSN, next LSN
logs = [("L1", "east", 145, 180), ("L2", "east", 180, 210),
        ("L3", "east", 210, 235), ("other", "west", 180, 240)]

def chain_to(target, available_logs):
    eligible = [d for d in diffs if d[1] == full["checkpoint"]
                and d[2] == full["fork"] and d[3] <= target]
    diff = max(eligible, key=lambda d: d[3])
    chain = [full["id"], diff[0]]
    next_lsn = diff[3]
    while next_lsn <= target:
        options = [log for log in available_logs if log[1] == full["fork"]
                   and log[2] <= next_lsn < log[3]]
        if not options:
            return f"gap at {next_lsn} after " + " -> ".join(chain)
        chosen = max(options, key=lambda log: log[3])
        chain.append(chosen[0])
        next_lsn = chosen[3]
    return " -> ".join(chain)

print(chain_to(197, logs))
print(chain_to(197, [log for log in logs if log[0] != "L2"]))
Check the result
F1 -> D1 -> L1 -> L2
gap at 180 after F1 -> D1 -> L1

The first log may overlap the end of the differential. A later log from another fork cannot fill the gap. This fixture assumes a compatible differential is available. In a real restore, inspect backup headers, restore to a separate destination, leave intermediate restores unrecovered, use the same STOPAT time for log restores and validate the application after recovery. Try target LSN 210 and explain why L3 is required.

Related lesson · Prove a backup restore and a regional failover

Knowledge check

Rehearse a point-in-time restore quiz

Answer 3 questions. Check each answer for an explanation.

Worked example · Rehearse a point-in-time restore