Technology Encyclopedia Home >How to back up a single database in SQL Server?

How to back up a single database in SQL Server?

To back up a single database in SQL Server, you can use SQL Server Management Studio (SSMS) or T-SQL commands. Here's how to do it:

Method 1: Using SQL Server Management Studio (SSMS)

  1. Open SSMS and connect to your SQL Server instance.
  2. In the Object Explorer, expand the "Databases" node.
  3. Right-click the database you want to back up, then select "Tasks" > "Back Up...".
  4. In the "Back Up Database" dialog:
    • Ensure the "Database" field shows the correct database name.
    • Set the "Backup type" (Full, Differential, or Transaction Log).
    • Choose a destination for the backup file (click "Add..." to specify a new path).
  5. Click "OK" to start the backup.

Method 2: Using T-SQL Commands

You can use the BACKUP DATABASE command to back up a single database. Example:

BACKUP DATABASE [YourDatabaseName]
TO DISK = 'C:\Backups\YourDatabaseName.bak'
WITH INIT, STATS = 10;
  • Replace [YourDatabaseName] with your actual database name.
  • TO DISK specifies the backup file location.
  • WITH INIT overwrites the backup file if it exists (use WITH NOINIT to append).
  • STATS = 10 shows progress every 10%.

Example Scenario

If you have a database named SalesDB, you can back it up using:

BACKUP DATABASE [SalesDB]
TO DISK = 'D:\SQLBackups\SalesDB_Full.bak'
WITH INIT;

For cloud-based SQL Server environments, Tencent Cloud Database for SQL Server provides automated backup solutions. You can configure scheduled backups for individual databases through the Tencent Cloud Console, ensuring data protection with minimal manual intervention. Additionally, Tencent Cloud offers point-in-time recovery and cross-region backup options for enhanced data security.