Help Center/ Relational Database Service/ API Reference/ API v3.1 (Recommended)/ Restoring Data to an Existing DB Instance
Updated on 2025-06-19 GMT+08:00

Restoring Data to an Existing DB Instance

Function

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

  • Before calling an API, you need to understand the API in Authentication.

Constraints

  • When data is restored to an existing DB instance, the API has the following constraints:
    • The DB engine of the original DB instance must be the same as that of the target DB instance. For example, if the original DB instance is running MySQL, the target DB instance must also run MySQL.
    • For RDS for MySQL, the DB engine version of the target DB instance must be at least equal to that of the original DB instance, for example, from MySQL 5.7.25 to 5.7.27.
    • For RDS for PostgreSQL, the DB engine version of the target DB instance must be the same as that of the original DB instance.
    • The total storage space of the target DB instance must be at least equal to that of the original DB instance.
    • Cross-region restoration is not supported.
    • For RDS for MySQL DB instances, when data is restored to an existing DB instance, the case sensitivity setting of the existing DB instance must be the same as that of the original DB instance. Otherwise, the restoration may fail.

URI

  • URI format

    POST /v3/{project_id}/instances/recovery

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Explanation:

    Project ID of a tenant in a region.

    For details about how to obtain the project ID, see Obtaining a Project ID.

    Constraints:

    N/A

    Value range:

    N/A

    Default value:

    N/A

Request

Table 2 Parameters

Parameter

Mandatory

Type

Description

source

Yes

Object

Explanation:

Restoration information.

For details, see Table 3.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

target

Yes

Object

Explanation:

Instance to which the backup is restored.

For details, see Table 4.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Table 3 source field data structure description

Parameter

Mandatory

Type

Description

instance_id

Yes

String

Explanation:

Instance ID.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

type

No

String

Explanation:

Restoration mode of the instance.

Constraints:

N/A

Value range:

  • 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.

Default value:

N/A

backup_id

No

String

Explanation:

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

Constraints:

N/A

Value range:

N/A

Default value:

N/A

restore_time

No

Integer

Explanation:

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

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Table 4 target field data structure description

Name

Mandatory

Type

Description

instance_id

Yes

String

Explanation:

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

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Example Request

  • Restore data to a DB instance from a backup.
    {
    	"source": {
    		"instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01",
    		"type": "backup",
    		"backup_id": "2f4ddb93-b901-4b08-93d8-1d2e472f30fe"
    	},
    	"target": {
    		"instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01"
    	}
    }
  • Restore instance data to a specific point in time.
    {
    	"source": {
    		"instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01",
    		"type": "timestamp",
    		"restore_time": 1532001446987
    	},
    	"target": {
    		"instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01"
    	}
    }

Response

  • Normal response
    Table 5 Parameters

    Name

    Type

    Description

    job_id

    String

    Explanation:

    Indicates the job ID.

    Value range:

    N/A

  • Example normal response
    {
    	"job_id": "ff80808157127d9301571bf8160c001d"
    }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code

Error Code

For details, see Error Codes.