T-SQL Tutorial

Backup entire database - TSQL Tutorial


The following example backs up the master database to a disk file.

BACKUP DATABASE Syntax:

BACKUP DATABASE { database_name }
TO backup_device [ ,...n ]
[ MIRROR TO clause ]
[ WITH { DIFFERENTIAL | [ ,...n ] } ];

BACKUP DATABASE Example:

BACKUP DATABASE master
TO DISK = 'E:\SQLServerBackup\master.bak'
WITH FORMAT;
GO

Messages:
Processed 464 pages for database 'master', file 'master' on file 1.
Processed 3 pages for database 'master', file 'mastlog' on file 1.
BACKUP DATABASE successfully processed 467 pages in 0.274 seconds (13.308 MB/sec).