Help Center> Relational Database Service> API Reference> API v3 (Recommended)> Backup and Restoration> Restoring Databases to a Specified Point in Time (RDS for MySQL)
Updated on 2024-06-07 GMT+08:00

Restoring Databases to a Specified Point in Time (RDS for MySQL)

Function

This API is used to restore databases to a specified point in time.

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

Constraints

  • This API is available to RDS for MySQL only.
  • Database-level restoration is not supported for databases that contain tables with JSON virtual columns.
  • Database-level restoration is not supported for databases whose names contain Chinese characters.
  • Fast restoration is not supported for XA transactions.

URI

  • URI format

    POST /v3/{project_id}/instances/batch/restore/databases

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Project ID of a tenant in a region.

    To obtain it, refer to Obtaining a Project ID.

Request

Table 2 Parameters

Parameter

Mandatory

Type

Description

instances

Yes

Array of objects

Instance information. For details, see Table 3.

Table 3 instances field data structure description

Parameter

Mandatory

Type

Description

restore_time

Yes

Long

Restoration time point. A timestamp in milliseconds is used.

instance_id

Yes

String

Instance ID. Only RDS for MySQL instances are supported.

databases

Yes

Array of objects

Database information. For details, see Table 4.

is_fast_restore

No

Boolean

Whether to use fast restoration. The value can be true or false.

Table 4 databases field data structure description

Parameter

Mandatory

Type

Description

old_name

Yes

String

Name of the database before restoration. The database name cannot contain Chinese characters.

new_name

Yes

String

Name of the database after restoration. The database name can contain letters, digits, hyphens (-), underscores (_), and dollar signs ($). The new database name cannot be the same as the original database name.

Example Request

Restore databases of an RDS for MySQL instance to a specified point in time.

{
  "instances" : [ {  
     "instance_id" : "5d742eda6e574ff3a003191638ef8c51in01",  
     "restore_time" : 1699323939000,  
     "databases" : [ {  
       "old_name" : "dbtest",  
       "new_name" : "dbtest_restore"  
     } ]  
   } ]  
}

Response

  • Normal response
    Table 5 Parameters

    Parameter

    Type

    Description

    restore_result

    Array of objects

    Database-level PITR task information. For details, see Table 6.

    Table 6 restore_result field data structure description

    Parameter

    Type

    Description

    instance_id

    String

    Instance ID.

    job_id

    String

    Workflow ID.

  • Example normal response

    Restoring databases to a specified point in time:

    {  
       "restore_result" : [ {  
         "instance_id" : " 5d742eda6e574ff3a003191638ef8c51in01",  
         "job_id" : "749d6254-f4f0-4f72-aa32-876e220d2496"  
       } ]  
     }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code

Error Code

For details, see Error Codes.