Backing up a SQL database is an important task and is the process of creating a copy of data to ensure the availability and recoverability of data in case of system failure and to protect from data loss or corruption.
1. Run below SQL command in SSMS :
BACKUP DATABASE [AdventureWorks2019] TO DISK = 'C:\Users\Public\Documents\AdventureWorks2019_Backup.bak' WITH INIT, COMPRESSION, STATS = 10;
The INIT option specifies that any existing backup files should be overwritten, the COMPRESSION option enables backup compression, and the STATS option specifies the level of detail for backup progress reporting.
2. Above command will backup the [AdventureWorks2019] database to a file named "AdventureWorks2019.bak" located in the "C:\Users\Public\Documents" folder.
That's it! You have successfully backup up [AdventureWorks2019] database using T-SQL.
1. In Object explorer, expand the "Databases folder" >> Right-click on the database you want to backup and select tasks >> Select Back Up option.
2. In the Back Up Database window, select the type of backup you want to perform : Full, Differential. >> Click on Add button to add backup destination folder location.
A full backup is that copies all the data and objects in a database to a backup file.
A differential backup is a backup type that captures changes made to a database since the last full backup. Which includes all changes made to the database since the last full backup.
3. Next, click on ellipsis ( three dots ).
4. Select backup destination folder location and give a file name with extension ".bak" >> Click "OK".
5. Click on the "OK" button to start the backup process.
That's it! You have successfully backup up [AdventureWorks2019] database using GUI.
To verify the backup file, Please open backup destination file location as give in below image.
To backup an entire SQL database, use the appropriate command like "BACKUP DATABASE" for SQL Server.
The main three types of backups in SQL are full backups, differential backups, and transaction log backups.
The backup command in SQL varies depending on the database management system used, such as "BACKUP DATABASE" for SQL Server.
In a database context, a backup refers to a copy of the database's data and structure, often created to safeguard against data loss or corruption.