SQL Database
An existing SQL database can be completely backed up using the BACKUP DATABASE statement in SQL Server.
BACKUP DATABASE databasename
TO DISK = 'filepath';
Only the database’s modified sections are backed up via a differential backup, which is different from a full database backup.
BACKUP DATABASE databasename
TO DISK = 'filepath'
WITH DIFFERENTIAL;
A complete backup of the current database “testDB” is created to the D drive using the SQL query that follows:
BACKUP DATABASE testDB
TO DISK = 'D:\backups\testDB.bak';
Advice: Make sure to regularly backup your database to a drive other than the one you use for it. This way, in the event of a disk crash, your backup file and the database will not be lost.
The database “testDB” is differentially backed up using the SQL query that follows:
BACKUP DATABASE testDB
TO DISK = 'D:\backups\testDB.bak'
WITH DIFFERENTIAL;
A differential backup shortens the backup duration because it only backs up the modifications.
CodingAsk.com is designed for learning and practice. Examples may be made simpler to aid understanding. Tutorials, references, and examples are regularly checked for mistakes, but we cannot guarantee complete accuracy. By using CodingAsk.com, you agree to our terms of use, cookie, and privacy policy.
Copyright 2010-2024 by Refsnes Data. All Rights Reserved.