Home | Tables | Procedures
Backup Layer - Execution
cfg.usp_BackupDatabase is a core component of the framework responsible for executing SQL Server backups based on a configurable and policy-driven strategy.
It supports FULL, DIFF, and LOG backups, integrating compression, checksum validation, and optional mirrored destinations while generating execution telemetry for auditing and analysis.
This procedure is designed to standardize backup operations and serve as the foundation for downstream recovery validation workflows.
- Execute FULL / DIFF / LOG backups
- Apply compression and checksum options
- Support PRIMARY and SECONDARY (mirrored) backup paths
- Integrate with backup telemetry
[log].[BackupRun] - Enforce policy-driven backup behavior via
[cfg].[DatabasePolicy]
| Parameter | Type | Description |
|---|---|---|
| @DatabaseName | SYSNAME | Target database to be backed up |
| @BackupType | VARCHAR(10) | Type of backup: FULL / DIFF / LOG |
| @TierID | TINYINT | Logical backup tier for path resolution |
| @PathType | VARCHAR(30) | Backup destination type (PRIMARY / SECONDARY) |
| @UseMirrorToSecondary | BIT | Enables mirrored backup to secondary path |
| @WithVerify | BIT | Executes RESTORE VERIFYONLY after backup |
| @CopyOnly | BIT | Executes COPY_ONLY backup |
| @WithChecksum | BIT | Enables backup checksum validation |
| @WithCompression | BIT | Enables backup compression |
| @StatsPercent | TINYINT | Progress reporting interval |
| @CorrelationID | UNIQUEIDENTIFIER | Correlation ID for telemetry tracking |
The procedure follows a structured execution pattern:
- Resolve backup configuration based on input parameters and policy
- Determine target paths (PRIMARY / SECONDARY)
- Execute BACKUP command with configured options
- Optionally perform backup verification
- Persist execution results into
[log].[BackupRun]
EXEC cfg.usp_BackupDatabase
@DatabaseName = 'AdventureWorks2022',
@BackupType = 'FULL',
@WithCompression = 1,
@WithChecksum = 1;Each execution generates a telemetry record in [log].[BackupRun], capturing execution timing, backup type, storage paths, verification results, and error diagnostics.
[cfg].[DatabasePolicy]→ Backup configuration rules[log].[BackupRun]→ Backup execution telemetry[cfg].[usp_BackupByTierAndType]→ Batch backup orchestration
Home | Tables | Procedures