A database in Sql Server is a storage location where we can store our data. The SQL database uses tables to store our information in a normalizes way. So that, We can easily Select, Update and Delete the business data.
The SQL BACKUP DATABASE statement is used in SQL Server to create a full back up of an existing SQL database.
SQL> BACKUP DATABASE databasename TO DISK = 'filepath';
BACKUP DATABASE demoDB TO DISK = 'E:\backups\demoDB.bak';
The above SQL statement creates a full back up of an existing database "demoDB"
to the E disk:
The below SQL statement creates a differential back up of the database "demoDB"
BACKUP DATABASE databasename TO DISK = 'filepath' WITH DIFFERENTIAL;
BACKUP DATABASE demoDB TO DISK = 'E:\backups\demoDB.bak' WITH DIFFERENTIAL;
The above SQL statement creates a full back up of an existing database "demoDB"
to the E disk differentially:
This command uses the "WITH FILE"
option to specify a file backup.
You need to specify the logical filename within the database which can be obtained by using the command sp_helpdb
'databaseName'
, specifying the name of your database.
BACKUP DATABASE demoDB FILE = 'demoDB' TO DISK = 'C:\demoDB_demoDB.FIL' GO