Restoring Data to an Existing DB Instance

Function

This API is used to restore a database to an existing DB Instance.

Constraints

URI

Request

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

The content type.

The default value is application/json.

X-Auth-Token

Yes

String

Specifies the user token.

The user token is a response to the API used to obtain a user token.

Table 4 Parameter description

Name

Mandatory

Type

Description

source

Yes

Object

Restoration information.

For details, see Table 5.

target

Yes

Object

Instance to which the backup is restored.

For details, see Table 6.

Table 5 source field data structure description

Parameter

Mandatory

Type

Description

instance_id

Yes

String

Instance ID.

type

No

String

Restoration mode of the instance. Enumerated values include:

  • backup: indicates using backup files for restoration. In this mode, type is not mandatory and backup_id is mandatory.
  • timestamp: indicates the point-in-time restoration mode. In this mode, type and restore_time are mandatory.

backup_id

No

String

ID of the backup used to restore data. This parameter must be specified when the backup file is used for restoration.

restore_time

No

Integer

Time point of data restoration in the UNIX timestamp format. The unit is millisecond and the time zone is UTC.

database_name

No

Map<String, String>

Name of the new database after the restoration. If this parameter is available, you can restore specific databases and rename new databases.

  • This parameter is only available to RDS for SQL Server.
  • If this parameter is not specified, all databases are restored by default.
  • Before the restoration, make sure that the size of the restored data does not exceed the purchased disk capacity. Expand disk capacity, if necessary.
  • You can enter multiple new database names and separate them with commas (,). The new database names can contain the original database names.
  • New database names must be different from the original database names. If they are left blank, the original database names will be used for restoration by default.
  • Check whether new database names are case sensitive based on the character set selected during instance creation and make sure each new database name is unique.
  • The total number of new and existing databases on the existing or original DB instances where data is restored cannot exceed the database quota specified by rds_databases_quota.
  • New database names cannot contain the following fields (case-insensitive): rdsadmin, master, msdb, tempdb, model, and resource.
  • New database names must consist of 1 to 64 characters, including only letters, digits, underscores (_), and hyphens (-). If you want to restore data to multiple new databases, separate them with commas (,).
  • New database names must be different from any database names on the original DB instance.
  • New database names must be different from any database names on the existing or original DB instances where data is restored.
Example:
"database_name":{"Original database name":"New database name"}

Correct example: "database_name":{"A":"A,A1,A2","B":"B1,B2","C":""}

Wrong example: "database_name":{"A":"A","B":"B1,B2","C":"B1,C1","D":"D1,d1"},

Error causes are as follows:

  • The new database name (A) is the same as the original database name (A).
  • The new database name (B1) is not unique.
  • When the database name is case insensitive, the database names D1 and d1 conflict.
  • Exercise caution when restoring data to an existing or original DB instance.

restore_all_database

No

Boolean

Whether to restore all databases to the target instance.

This field is available only for Microsoft SQL Server. Enumerated values include:

  • true: All databases will be restored to the target instance.
  • false: Not all databases will be restored to the target instance.

The default value is false.

Table 6 target field data structure description

Name

Mandatory

Type

Description

instance_id

Yes

String

Specifies the ID of the DB instance where the backup will be restored to.

Example Request

Response

Status Code

Error Code

For details, see Error Codes.