BACKUP DATABASE (often shortened in conversation to BACKUP DB) is a data-protection command that writes all pages of the specified database, plus transaction-log information needed for a consistent restore, to one or more backup devices. In SQL Server it is the foundation of disaster-recovery planning, allowing full, differential, and copy-only backups. The statement runs online, meaning the database remains readable and writable during the operation. Backups can be written to disk files, tapes, URL endpoints (Azure storage), or logical devices. Options control compression, checksum validation, encryption, stats output, and whether the backup is full, differential, or copy-only. BACKUP DATABASE does not truncate the transaction log (that is handled by BACKUP LOG) and it does not verify restorability until a RESTORE VERIFYONLY is run. Adequate permissions (sysadmin or db_owner plus BACKUP DATABASE privilege) are required. Although other platforms support backup utilities, the BACKUP DATABASE T-SQL command is specific to SQL Server and Sybase-derived engines.
database_name
(sysname) - Name of the database to back upTO
(clause) - One or more backup devices (DISK, TAPE, or URL) and their pathsDIFFERENTIAL
(keyword) - Backs up only changed extents since last full backupCOPY_ONLY
(keyword) - Takes a full backup that does not reset the differential baseCOMPRESSION
(keyword) - Compresses the backup (Enterprise or later editions where supported)DESCRIPTION
(string) - Human-readable description stored in the backup headerNAME
(string) - Logical name for the backup setCHECKSUM
(keyword) - Verifies page checksums while backing up and stores them in the fileSTATS
(int) - Percent-complete reporting intervalENCRYPTION
(clause) - Encrypts the backup using a certificate or asymmetric keyFORMAT, INIT
(keyword) - Controls whether to overwrite or append to existing mediaRESTORE DATABASE, BACKUP LOG, RESTORE VERIFYONLY, DATABASE MIRRORING, Always On Availability Groups, Differential Backup, Copy-Only Backup, CHECKSUM
Microsoft SQL Server 7.0 (1998)
Members of the sysadmin fixed server role, the db_owner database role, or users granted the BACKUP DATABASE permission can execute the command.
No. Only BACKUP LOG (or switching the recovery model to SIMPLE) truncates inactive log records.
Yes. Specify additional TO DISK clauses to create a striped backup, improving throughput.
Run RESTORE VERIFYONLY FROM DISK = 'path_to_backup.bak';