BACKUP DATABASE

To create a full backup of the database, we use following syntax:

Syntax:

BACKUP DATABASE database_name
TO DISK = 'filepath';

Example: To create full backup of learn2done database.

BACKUP DATABASE learn2done
TO DISK = 'E:\backup\learn2done.bak';

Using ‘DIFFERENTIAL BACKUP’ statement:

  • The ‘DIFFERENTIAL BACKUP’ statement only backups the parts of database which have been changed since last full backup of database.
  • Differential backup consumes less time as compared to full backup as only changes are backed up.

Syntax:

BACKUP DATABASE database_name
TO DISK = 'filepath'
WITH DIFFERENTIAL;

Example: To create differential backup of learn2done database.

BACKUP DATABASE learn2done
TO DISK = 'E:\backup\learn2done.bak'
WITH DIFFERENTIAL;