Reviewed-by: Gladkov, Maksim <mgladkov@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: wangdengke2 <wangdengke2@huawei.com> Co-committed-by: wangdengke2 <wangdengke2@huawei.com>
23 KiB
Restoring Data to an Existing or Original DB Instance
Function
This API is used to restore a database to an existing or the original DB instance.
- Before calling an API, you need to understand the API in Authentication.
- Before calling this API, obtain the required region and endpoint.
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.
- For RDS for SQL Server, the time zone of the target DB instance must be the same as that of the original DB instance. Otherwise, data inconsistency may occur.
- For version constraints of RDS for SQL Server, see Table 1.
- The total storage space of the target DB instance must be at least equal to that of the original DB instance for RDS for MySQL.
- 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 MySQL and Microsoft SQL Server DB engines.
Table 1 Restoring to specific DB engine versions Original DB Engine Version
Restore To
2017 Standard Edition
2017 Standard Edition
2017 Enterprise Edition
2019 Standard Edition
2019 Enterprise Edition
2017 Enterprise Edition
2017 Enterprise Edition
2019 Enterprise Edition
2019 Standard Edition
2019 Standard Edition
2019 Enterprise Edition
2022 Standard Edition
2022 Enterprise Edition
2019 Enterprise Edition
2019 Standard Edition
2019 Enterprise Edition
2022 Enterprise Edition
2022 Standard Edition
2022 Standard Edition
2022 Enterprise Edition
2022 Enterprise Edition
2022 Standard Edition
2022 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
- Parameter description
Table 3 Parameter description 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.
Table 4 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
Integer
Specifies the time point of data restoration in the UNIX timestamp. The unit is millisecond and the time zone is UTC.
- Example
POST https://rds.eu-de.otc.t-systems.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/recovery
- 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" } }
Response
- Normal response
Table 6 Parameter description Name
Type
Description
job_id
String
Indicates the task 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.