Restoring Data to an Existing DB Instance
Function
This API is used to restore a database to an existing DB instance.
This API will be unavailable on March 31, 2025. You are advised to switch workloads to the new API (Restoring Data to an Existing DB Instance) before then.
- Before calling an API, you need to understand the API in Authentication.
Constraints
- Microsoft SQL Server supports batch calling of this API to restore one database to an existing DB instance.
- This API does not support RDS for PostgreSQL instance restoration.
- 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.
- The target DB instance version must be later than or equal to that of the source instance. For example, MySQL 5.7.25 DB instance can be restored to MySQL 5.7.27 DB instance. For constraints of Microsoft SQL Server, see Table 1.
- For RDS for MySQL, the total storage space of the target DB instance must be greater than or 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.
- When data is restored to an original DB instance:
This API is supported only for the Microsoft SQL Server DB engine.
Table 1 Restoring to the DB engine versions supported by RDS for SQL Server Original DB Engine Version
Restore To
2008 Standard Edition
2008 Standard Edition
2012 Web Edition
2012 Web Edition
2012 Standard Edition
2012 Enterprise Edition
2012 Standard Edition
2012 Standard Edition
2012 Enterprise Edition
2012 Enterprise Edition
2012 Enterprise Edition
2014 Standard Edition
2014 Standard Edition
2014 Enterprise Edition
2014 Enterprise Edition
2014 Enterprise Edition
2016 Standard Edition
2016 Standard Edition
2016 Enterprise Edition
2016 Enterprise Edition
2016 Enterprise Edition
2017 Web Edition
2017 Web Edition
2017 Standard Edition
2017 Enterprise Edition
2017 Standard Edition
2017 Standard Edition
2017 Enterprise Edition
2017 Enterprise Edition
2017 Enterprise Edition
URI
- URI format
- Parameter description
Table 2 Parameter description Name
Mandatory
Description
project_id
Yes
Specifies the project ID of a tenant in a region.
For details about how to obtain the project ID, see Obtaining a Project ID.
Request
Name |
Mandatory |
Type |
Description |
---|---|---|---|
source |
Yes |
Object |
Specifies the restoration information. For details, see Table 4. |
target |
Yes |
Object |
Specifies the restoration target. For details, see Table 5. |
Name |
Mandatory |
Type |
Description |
---|---|---|---|
instance_id |
Yes |
String |
Specifies the DB instance ID. |
type |
No |
String |
Specifies the restoration mode. Enumerated values include:
|
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 |
Integer |
Specifies the time point of data restoration in the UNIX timestamp. The unit is millisecond and the time zone is UTC. |
database_name |
No |
Map<String, String> |
This parameter applies only to the Microsoft SQL Server DB engine.
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:
NOTICE:
Before the restoration, make sure that the size of the restored data does not exceed the purchased disk capacity. Expand disk capacity, if necessary. |
Example Request
Use backup files for restoration:
MySQL:
https://{endpoint}/v3/0483b6b16e954cb88930a360d2c4e663/instances/recovery { "source": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01", "type": "backup", "backup_id": "2f4ddb93-b901-4b08-93d8-1d2e472f30fe" }, "target": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01" } }
Microsoft SQL Server:
{ "source": { "instance_id": "61879e6085bc44d1831b0ce62d988fd9in04", "type": "backup", "backup_id": "b021670e69ba4538b7b2ed07257306aebr04", "database_name": { "db1": "dbtest1", "db2": "" } }, "target": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin04" } }
Use PITR for restoration:
MySQL:
{ "source": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01", "type": "timestamp", "restore_time": 1532001446987 }, "target": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin01" } }
Microsoft SQL Server:
{ "source": { "instance_id": "61879e6085bc44d1831b0ce62d988fd9in04", "type": "timestamp", "restore_time": 1532001446987, "database_name": { "db1": "dbtest1,dbtest2", "db2": "db2,db02", "db3": "" } }, "target": { "instance_id": "d8e6ca5a624745bcb546a227aa3ae1cfin04" } }
Response
- Normal response
Table 6 Parameter description Name
Type
Description
job_id
String
Indicates the job ID.
- Example normal response
{ "job_id": "ff80808157127d9301571bf8160c001d" }
- Abnormal response
For details, see Abnormal Request Results.
Status Code
- Normal
- Abnormal
For details, see Status Codes.
Error Code
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot