Help Center/ Relational Database Service/ User Guide/ Working with RDS for SQL Server/ Data Restorations/ Restoring Backup Files to a Self-built SQL Server Database Using SQL Statements
Updated on 2024-07-22 GMT+08:00

Restoring Backup Files to a Self-built SQL Server Database Using SQL Statements

You can download backup files by referring to Downloading a Backup File and restore data from them. You can use SQL Server Management Studio (SSMS) to restore data to a self-built database on an ECS or an on-premises database. This section describes how to use SQL statements to restore data from backup files to an on-premises database.

  • Before restoring data, ensure that the ECS has been installed with an SQL Server database of the same version as or later than your RDS for SQL Server instance.
  • You can download an unsynchronized backup as required and use the unsynchronized backup and the most recent backup to restore data. To obtain the most recent backup, contact customer service.

Procedure

  1. Download the required backup file to a local directory by referring to Downloading a Backup File.
  2. Check logical information about the backup file and ensure that the information in the query result is correct.

    RESTORE FILELISTONLY FROM DISK = 'Local directory for the backup file';

  3. Restore data to your on-premises database.

    RESTORE DATABASE [xxx] FROM DISK = 'Local directory for the backup file';