Overview
Backup and restore are fundamental operations for protecting your SQL Server data. This documentation provides a comprehensive guide to the concepts, commands, and best practices for safeguarding your databases.
Learn About Full BackupsKey Concepts
- Backup Types: Full, Differential, Transaction Log, File/Filegroup, Copy-only.
- Recovery Models: Simple, Full, Bulk‑logged.
- Backup Devices: Disk files, tape, Azure Blob storage.
- Restore Options: WITH RECOVERY, WITH NORECOVERY, WITH STANDBY.
Backup Process
SQL Server creates a backup by reading the pages of the database and writing them to a backup set. The process can be executed via T‑SQL, SQL Server Management Studio (SSMS), or PowerShell.
BACKUP DATABASE [AdventureWorks]
TO DISK = N'C:\Backups\AdventureWorks_Full.bak'
WITH INIT, COMPRESSION, STATS = 10;
Restore Process
Restoring a database involves applying one or more backup sets to bring the database to a desired point in time.
RESTORE DATABASE [AdventureWorks]
FROM DISK = N'C:\Backups\AdventureWorks_Full.bak'
WITH REPLACE, RECOVERY;