Backup and Restore: Strategy and Native Tools
Recommend database backup strategies. Perform backup and restore using native tools and T-SQL for Azure SQL Database, Managed Instance, and SQL on VMs.
Backup fundamentals
Backups are your safety net.
A full backup copies the entire database β like photocopying every page of a book.
A differential backup copies only what changed since the last full backup β like noting which pages were edited.
A log backup copies the transaction log β like saving a recording of every edit as it happened. This enables point-in-time recovery.
Backup strategy by platform
| Aspect | SQL Database | Managed Instance | SQL on VMs |
|---|---|---|---|
| Automated backups | Yes (Azure managed) | Yes (Azure managed) | Optional (via SQL IaaS extension) |
| Full backup frequency | Weekly | Weekly | You schedule |
| Differential frequency | Every 12-24 hours | Every 12-24 hours | You schedule |
| Log backup frequency | Every 5-10 minutes | Every 5-10 minutes | You schedule |
| Retention (PITR) | 1-35 days (default 7) | 1-35 days (default 7) | N/A (manual) |
| Long-term retention | LTR policy (up to 10 years) | LTR policy (up to 10 years) | Manual (backup to Blob Storage) |
| Custom backups (BACKUP TO URL) | No (only automated) | Yes (copy-only to Blob) | Yes (full/diff/log to Blob) |
| Backup storage | Azure managed (GRS/LRS/ZRS) | Azure managed (GRS/LRS/ZRS) | You manage (local/Blob) |
Automated backups (SQL DB and MI)
Azure automatically manages the backup chain:
- Full backups: Weekly
- Differential backups: Every 12-24 hours
- Log backups: Every 5-10 minutes
- Storage redundancy: LRS, ZRS, or GRS (configurable at database creation)
- Retention: 1-35 days for PITR (default 7 days)
You donβt run BACKUP commands on Azure SQL Database β Azure handles it. For MI, you can take additional copy-only backups to Blob Storage.
Native backup with T-SQL
For MI and SQL on VMs:
-- Full backup to Azure Blob Storage
BACKUP DATABASE NorthStarERP
TO URL = 'https://northstarstorage.blob.core.windows.net/backups/NorthStarERP_Full.bak'
WITH CREDENTIAL = 'AzureStorageCredential',
COMPRESSION, CHECKSUM, INIT;
-- Differential backup
BACKUP DATABASE NorthStarERP
TO URL = 'https://northstarstorage.blob.core.windows.net/backups/NorthStarERP_Diff.bak'
WITH CREDENTIAL = 'AzureStorageCredential',
DIFFERENTIAL, COMPRESSION, CHECKSUM;
-- Transaction log backup
BACKUP LOG NorthStarERP
TO URL = 'https://northstarstorage.blob.core.windows.net/backups/NorthStarERP_Log.trn'
WITH CREDENTIAL = 'AzureStorageCredential',
COMPRESSION, CHECKSUM;
-- Copy-only backup (doesn't break the backup chain)
BACKUP DATABASE NorthStarERP
TO URL = 'https://northstarstorage.blob.core.windows.net/backups/NorthStarERP_CopyOnly.bak'
WITH CREDENTIAL = 'AzureStorageCredential',
COPY_ONLY, COMPRESSION;
COPY_ONLY backups β when and why
A COPY_ONLY backup doesnβt affect the backup chain (doesnβt reset the differential base or break log chain):
- Use for ad-hoc copies (dev refresh, migration, archiving)
- MI: only COPY_ONLY backups are allowed to Blob Storage (Azure manages the primary chain)
- Always use COPY_ONLY when taking manual backups alongside automated Azure backups
Native restore
Restore on SQL Server (VMs)
-- Restore a full backup
RESTORE DATABASE NorthStarERP
FROM URL = 'https://northstarstorage.blob.core.windows.net/backups/NorthStarERP_Full.bak'
WITH CREDENTIAL = 'AzureStorageCredential',
NORECOVERY; -- keep restoring diff + logs
-- Restore differential
RESTORE DATABASE NorthStarERP
FROM URL = 'https://northstarstorage.blob.core.windows.net/backups/NorthStarERP_Diff.bak'
WITH CREDENTIAL = 'AzureStorageCredential',
NORECOVERY;
-- Restore log
RESTORE LOG NorthStarERP
FROM URL = 'https://northstarstorage.blob.core.windows.net/backups/NorthStarERP_Log.trn'
WITH CREDENTIAL = 'AzureStorageCredential',
RECOVERY; -- bring database online
Restore on Managed Instance
-- Restore from Blob Storage to MI
RESTORE DATABASE NorthStarERP
FROM URL = 'https://northstarstorage.blob.core.windows.net/backups/NorthStarERP_Full.bak'
WITH REPLACE; -- overwrite if exists
Azure SQL Database restore
SQL Database doesnβt use T-SQL RESTORE. Instead:
- Point-in-time restore: Azure Portal, PowerShell, or CLI (creates a new database)
- Geo-restore: Restore from geo-redundant backup to a different region
- LTR restore: Restore from long-term retention backup
Backup strategy recommendations
| Workload Type | Full | Differential | Log | Retention |
|---|---|---|---|---|
| Mission-critical OLTP | Daily | Every 6 hours | Every 5-15 min | 35 days PITR + 1 year LTR |
| Standard business app | Weekly | Daily | Every 15-30 min | 14 days PITR + 3 months LTR |
| Dev/test | Weekly | None | None (Simple recovery) | 7 days PITR |
| Compliance/regulatory | Weekly | Daily | Every 15 min | 35 days PITR + 7-10 years LTR |
Amara needs to take a manual backup of a database on Azure SQL Managed Instance for a dev team refresh. She doesn't want to affect the automated backup chain. What type of backup should she take?
π¬ Video coming soon
Next up: Point-in-Time Restore, LTR, and Cloud Backup β recover to any second within your retention window and configure long-term retention.