BACKUP (TSQL Statement)

creates a backup file of a database.

Syntax

BACKUP DATABASE database_name
    TO DISK =  'file_name'

Arguments

database_name
name of the database to backup.
‘file_name’
relative or absolute path of the backup file to create.
  • If file_name is a relative path, the base directory is given by the server parameter SERVER_DUMP_DIR.

Remarks

During the backup, an exclusive lock is set on the database. Other queries cannot access this database until the backup terminates.

Only sa or dbo is allowed to execute this statement.

Examples

BACKUP DATABASE mydb TO DISK='mydb_20160504.rbak'