• Relational Database Service

rds
  1. Help Center
  2. Relational Database Service
  3. API Reference
  4. API v3 (Recommended)
  5. Backup and Restoration
  6. Restoring Data to the Original DB Instance

Restoring Data to the Original DB Instance

Function

This API is used to restore data to the original DB instance.

NOTE:

When data is restored to an existing DB instance, the API has the following constraints:

  1. The database type of the original DB instance must be the same as that of the target existing DB instance. For example, the database types of both the original and existing DB instances are MySQL.
  2. The database version of the original DB instance must be the same as that of the target existing DB instance. For example, the database versions of both the original and existing DB instances are MySQL 5.7.
  3. The total volume size of the target existing DB instance must be greater than or equal to that of the original DB instance.
  4. Currently, Microsoft SQL Server does not support restoring data to an existing DB instance.

URI

  • URI format

    PATH: /{version_id}/{project_id}/instances/recovery

    Method: POST

  • Parameter description
    Table 1 Parameter description

    Name

    Mandatory

    Description

    version_id

    Yes

    Specifies the API version. It is case-sensitive and the value is v3.

    project_id

    Yes

    Specifies the project ID of a tenant in a region.

Request

  • Parameter description
    Table 2 Parameter description

    Name

    Mandatory

    Type

    Description

    source

    Yes

    Dictionary data structure

    Specifies the restoration information.

    For details, see Table 3.

    target

    Yes

    Dictionary data structure

    Specifies the restoration target.

    For details, see Table 4.

    Table 3 source field data structure description

    Name

    Mandatory

    Type

    Description

    instance_id

    Yes

    String

    Specifies the DB instance ID.

    type

    No

    String

    Specifies the restoration mode. 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 is mandatory and restore_time is no mandatory.

    backup_id

    No

    String

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

    restore_time

    No

    Int

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

    Table 4 target field data structure description

    Name

    Mandatory

    Type

    Description

    instance_id

    Yes

    String

    Specifies the ID of the DB instance to be restored to.

  • Request example
    Use backup files for restoration:
    {
    	"source": {
    		"instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01",
    		"type": "backup",
    		"backup_id": "2f4ddb93-b901-4b08-93d8-1d2e472f30fe"
    	},
    	"target": {
    		"instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01"
    	}
    }

    Use PITR for restoration:

    {
    	"source": {
    		"instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01",
    		"type": "timestamp",
    		"restore_time": 1532001446987
    	},
    	"target": {
    		"instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01"
    	}
    }

Normal Response

  • Parameter description
    Table 5 Parameter description

    Name

    Type

    Description

    job_id

    String

    Indicates the task ID.

  • Response example
    {
    	"job_id": "ff80808157127d9301571bf8160c001d"
    }

Abnormal Response

For details, see Abnormal Request Results.