SQLforGeeks
  • Home
  • SQL
  • SQL Tutorial
  • SQL Syntax
  • Our Services
Contact
  1. SQL
  2. Backup database

Text copied!

« Previous
Next »

Backup database

Dec. 8, 2022, 6:17 p.m. under SQL

  • Hi! You should check Restore database post first.

    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.

    There are several methods to backup SQL database, including using the graphical user interface (GUI) or Transact-SQL (T-SQL).
    Here's an example of how to backup database using T-SQL :

    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.

    Backup database

    2. Above command will backup the [AdventureWorks2019] database to a file named "AdventureWorks2019.bak" located in the "C:\Users\Public\Documents" folder.

    Backup database

    That's it! You have successfully backup up [AdventureWorks2019] database using T-SQL.

    Here's a step-by-step guide on how to backup SQL database using GUI :

    1. In Object explorer, expand the "Databases folder" >> Right-click on the database you want to backup and select tasks >> Select Back Up option.

    Backup database

    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.

    Full backup type :

    A full backup is that copies all the data and objects in a database to a backup file.

    Differential backup type :

    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.

    Backup database

    3. Next, click on ellipsis ( three dots ).

    Backup database

    4. Select backup destination folder location and give a file name with extension ".bak" >> Click "OK".

    Backup database

    5. Click on the "OK" button to start the backup process.

    Backup database Backup database

    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.

    Backup database

    Frequently Asked Questions :

    How do I backup an entire SQL database?

    To backup an entire SQL database, use the appropriate command like "BACKUP DATABASE" for SQL Server.

    What are the main 3 types of backups in SQL?

    The main three types of backups in SQL are full backups, differential backups, and transaction log backups.

    What is backup command in SQL?

    The backup command in SQL varies depending on the database management system used, such as "BACKUP DATABASE" for SQL Server.

    What is backup in database?

    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.
    Thank You! You should check Attach database post next.
    « Previous
    Next »
    RELATED :

    What is SQL

    What is T-SQL

    Difference between DBMS and Data Warehouse

    Download SQL Server

    Install SQL Server

    Download SQL Server Management Studio SSMS

    SQL Server Management Studio

    SQL Database

    Download database

    Restore database

    Attach database

    Detach database

    Create database

    Delete database

    Rename database

    Select database

    Database offline

    Database online

    SQL Commands

    SQL Tables

    Create table

    Truncate table

    Delete table

    Rename table

    Select table

    Alter table

    SQL Data Types

    SQL Comments

    SQL Constraints

    SQL Joins

    SQL inner join

    SQL left join

    SQL right join

    SQL full join

    SQL cross join

    SQL self join

    INSERT INTO SELECT statement

    INSERT INTO statement

    SQL Clauses

    SELECT clause

    FROM clause

    WHERE clause

    GROUP BY clause

    HAVING clause

    ORDER BY clause

    JOIN clause

    UNION clause

    UNION ALL clause

    TOP clause

    DISTINCT clause

    SQL Operators

    SQL Arithmetic operators

    SQL Comparison operators

    SQL Logical operators

    UNION operator

    UNION ALL operator

    INTERSECT operator

    EXCEPT operator

    LIKE operator

    NOT LIKE operator

    IN operator

    NOT IN operator

    IS NULL operator

    IS NOT NULL operator

    EXISTS operator

    NOT EXISTS operator

    BETWEEN operator

    NOT BETWEEN operator

    SQL Functions

    SQL Built-In functions

    CHARINDEX function

    DATEADD function

    CONCAT function

    LEN function

    REPLACE function

    SUBSTRING function

    CASE statement

    GETDATE function

    DATEPART function

    DATEDIFF function

    CAST function

    TRY_CAST function

    CONVERT function

    TRY_CONVERT function

    ISNULL function

    NULLIF function

    COALESCE function

    SQL Window functions

    ROW_NUMBER function

    RANK function

    DENSE_RANK function

    IIF function

    CHOOSE function

    SQL Store Procedure

    Store Procedure vs. Function

    SQL Subquery

    SQL Aliases

    Temp table

    SQL Error Handling

    SQL Variables

    SQL Views

    SQL Merge

    SQL CTE

    SQL WITH TIES

    Define Transaction in DBMS

    ACID properties in DBMS

    Types of Triggers in DBMS


    • Have Some Questions?
    logo

    Elevate your data experience with SQL excellence

    Quick Links
    •  Home
    •  SQL Tutorial
    •  SQL Syntax
    •  Our Services
    Our Services
    • Web Development
    • BI Development
    • Data Warehousing
    • Data Integration ETL


    Follow Us

    GST Registered: XXAXXXXXXXZX
    Mumbai, Maharashtra, India support@sqlforgeeks.com

    © 2025 Copyright™ | All Rights Reserved | Privacy Policy