Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

BACKUP DATABASE

BACKUP DATABASE

The BACKUP DATABASE command in SQL Server is utilized to generate a complete backup of an existing SQL database.

The provided SQL statement creates a full backup of the database “testDB” to the D disk.

Example

BACKUP DATABASE testDB
TO DISK = ‘D:\backups\testDB.bak’
Remember to: always back up the database onto a separate drive from where the actual database resides. This precaution ensures that in case of a disk failure, you won’t lose both the database and its backup file.

A differential backup exclusively captures the portions of the database altered since the last full database backup. The provided SQL statement initiates a differential backup of the database “testDB”.

Example

BACKUP DATABASE testDB
TO DISK = ‘D:\backups\testDB.bak’
WITH DIFFERENTIAL; 
Tip: A differential back up reduces the back up time (since only the changes are backed up).