How to create a differential database backup (Transact-SQL)
To create a differential database backup
Important It is not possible to create a differential database backup unless the database has been backed up first.
- Execute the BACKUP DATABASE statement to create the differential database backup, specifying:
- The name of the database to back up.
- The backup device where the database backup will be written.
- The DIFFERENTIAL clause, to specify that only the parts of the database that have changed after the last database backup was created are backed up.
- The name of the database to back up.
- Optionally, specify:
- The INIT clause to overwrite the backup media, and write the backup as the first file on the backup media. If no existing media header exists, one is automatically written.
- The SKIP and INIT clauses to overwrite the backup media even if there are either backups on the backup media that have not yet expired, or the media name does not match the name on the backup media.
- The FORMAT clause when using media for the first time to completely initialize the backup media and rewrite any existing media header.
The INIT clause is not required if the FORMAT clause is specified.
- The INIT clause to overwrite the backup media, and write the backup as the first file on the backup media. If no existing media header exists, one is automatically written.
Important Use extreme caution when using the FORMAT or INIT clauses of the BACKUP statement as this will destroy any backups previously stored on the backup media.
Examples
This example creates a full and a differential database backup for the MyNwind database.
-- Create a full database backup first.
BACKUP DATABASE MyNwind
TO MyNwind_1
WITH INIT
GO
-- Time elapses.
-- Create a differential database backup, appending the backup
-- to the backup device containing the database backup.
BACKUP DATABASE MyNwind
TO MyNwind_1
WITH DIFFERENTIAL
GO