BACKUP DATABASE is a data-protection statement available in Microsoft SQL Server that copies the entire database (or its differential changes) into a backup device such as a disk file, tape drive, or cloud storage URL. The backup captures the database at a transaction-consistent point in time, enabling later recovery with RESTORE DATABASE. You can run full, differential, or copy-only backups, mirror them to multiple locations, compress them, and verify them with CHECKSUM. BACKUP DATABASE can run while the database is online, using internal mechanisms to ensure data consistency. It requires appropriate permissions (typically membership in the sysadmin or db_backupoperator roles). A backup set’s reliability depends on regularly testing restores and storing copies off-site. The keyword is specific to SQL Server; other systems use external tools rather than an in-engine statement.
database_name
(sysname) - The database to back up.MIRROR TO
- Optional second, third, or fourth backup device for identical copies.DIFFERENTIAL
- Stores only changes since last full backup.COPY_ONLY
- Creates a backup that does not affect the differential base.FORMAT / NOFORMAT
- Overwrite or preserve existing media headers.INIT / NOINIT
- Overwrite or append within the media set.NAME
- Human-readable label for the backup set.COMPRESSION
- Compresses the backup (default depends on server setting).CHECKSUM
- Adds page checksums to validate on restore.STATS
- Reports progress every n percent.RESTORE DATABASE, BACKUP LOG, differential backup, transaction log backup, COPY_ONLY, CHECKSUM
Microsoft SQL Server 6.5
Members of the sysadmin fixed server role and the db_owner or db_backupoperator roles within the database can back up that database.
Yes. Specify multiple DISK clauses separated by commas or use MIRROR TO for identical copies. SQL Server stripes pages across the files, improving throughput.
Use RESTORE VERIFYONLY to check header and checksum integrity, or restore the backup to a non-production environment and run DBCC CHECKDB.
Compression reduces storage and network transfer size and is generally recommended, but it increases CPU usage. Benchmark on your workload before enabling by default.