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.
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”.
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). |