Overview
This API is used to restore a backed-up tenant, database, or table to the target cluster.
To initiate an offline tenant restore across OCPs from a global view (where the source cluster is not managed by the current OCP), see Initiate tenant restore globally.
API details
Constraints
The caller must have the permission to create tenants, databases, and tables in the target cluster for recovery.
The caller must pass the authentication for the OCP application service.
Request path
POST /api/v2/ob/clusters/{id}/backup/restore
Request parameters
Parameter |
Type |
Required |
Example value |
Description |
|---|---|---|---|---|
| id | Integer | Yes | 1001 | The ID of the backed-up cluster. |
Data structure of RestoreTenantParam
Parameter |
Type |
Required |
Description |
|
|---|---|---|---|---|
| backupTenantStatus | String | Yes | Backup tenant status. Valid values: |
|
| restoreOnlineTenantRequiredParam | Object | No | This parameter is required when the backup tenant is online. | |
| restoreObj | String | No | Object type to restore. Valid values: |
|
| tableRestoreObjects | Array | No | Information about the restored database or table. This parameter is required when restoreObj=database or restoreObj=table. | |
| \ | ----sourceDatabase | String | No | Source database. This parameter is specified when restoreObj is set to database. |
| \ | ----targetDatabase | String | No | Target database. This parameter is specified when restoreObj is set to database. |
| \ | ----sourceTable | String | No | Source table. This parameter is required when restoreObj is set to table. |
| \ | ----targetTable | String | No | Target table, which is passed in when restoreObj = table. |
| \ | ----backupClusterId | Long | Yes | Backup cluster ID. |
| \ | ----backupTenantId | Long | Yes | Backup tenant ID. |
| \ | ----restoreClusterId | Long | Yes | The cluster ID. |
| \ | ----restoreEndTime | OffsetDateTime | Yes | Restore to a specific point in time. |
| \ | ----restoreTenantInfoParam | Object | Yes | The target tenant model to be restored. |
| \ | ----restoreMethod | String | No | Specifies the data recovery method. The OBServer version must be greater than or equal to 4.3.3:Note |
| \ | ----name | String | Yes | Tenant name. |
| \ | ----primaryZone | String | No | Primary Zone. |
| \ | ----zones | Arrays | Yes | Zone configuration. |
| \ | ----name | String | Yes | The name of the zone. |
| \ | ----replicaType | String | Yes | Replica type. Valid values: |
| \ | ----resourcePool | Object | Yes | Resource pool configuration. |
| \ | ----unitSpecName | String | Yes | Specification name. |
| \ | ----unitCount | Long | Yes | Number of specifications. |
| restoreOfflineTenantRequiredParam | Object | Yes | This parameter is required when the backup tenant is offline. | |
| \ | ----backupMode | String | Yes | Backup method. |
| \ | ----backupClusterName | String | Yes | The name of the backup cluster. |
| \ | ----backupObClusterId | Long | No | The ID of the backup cluster on the OceanBase side. |
| \ | ----backupTenantName | String | Yes | Backup tenant name. |
| \ | ----backupObTenantId | Long | No | Backup tenant OceanBase ID. |
| \ | ----restoreClusterId | Long | Yes | The cluster ID. |
| \ | ----obBackupStorageBaseInfo | Object | Yes | For backup storage information, refer to the specific data structure in Create a backup policy for the cluster. |
| \ | ----restoreEndTime | OffsetDateTime | Yes | Restore to a specific point in time. |
| \ | ----restoreTenantInfoParam | Object | Yes | The target tenant model for restoration is the same as that used in online restoration. |
Response parameters
Parameter |
Type |
Description |
|---|---|---|
| data | Object | For more information, see BackupCommonResponsedata structure. |
| successful | Boolean | Whether the request is successful. |
| timestamp | Datetime | The timestamp when the server completed the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | An HTTP status code. |
| traceId | String | The trace ID of the request, used for troubleshooting. |
| server | String | The address of the application server that responds to the request. |
Data structure of BackupCommonResponse
Parameter |
Type |
Description |
|
|---|---|---|---|
| obBackupTaskType | String | Backup operation type, such as CREATE_BACKUP_STRATEGY. | |
| backupObjectOpsResultList | Array | Result set of backup object operations. | |
| \ | --obBackupObjectList | Array | Backup object list. |
| \ | --clusterId | Long | Cluster ID. |
| \ | --tenantId | Long | Tenant ID. |
| \ | --backupDimension | String | Backup dimension. For example, CLUSTER indicates cluster backup, and TENANT indicates tenant backup. |
| \ | --beSuccessful | Boolean | Whether the operation succeeded. |
| \ | --taskIdList | Array | List of task IDs, returned only if there are asynchronous tasks. |
| \ | --errorCode | Object | Error code. |
| \ | --hint | String | Tip. |
Examples
Request example
{
"backupTenantStatus": "ONLINE",
"restoreOnlineTenantRequiredParam": {
"restoreClusterId": 9,
"restoreTenantInfoParam": {
"name": "mysql_1",
"zones": [
{
"name": "zone1",
"replicaType": "FULL",
"resourcePool": {
"unitSpecName": "S1",
"unitCount": 1
}
}
],
"primaryZone": "zone1"
},
"backupClusterId": 9,
"backupTenantId": 21,
"restoreEndTime": "2020-11-11T00:50:00.215+08:00"
}
}
Response example
{
"data": {
"backupObjectOpsResultList": [
{
"beSuccessful": true,
"obBackupObjectList": [
{
"backupDimension": "CLUSTER",
"clusterId": 1000005
}
],
"taskIdList": [
3000041
]
}
],
"obBackupTaskType": "RESTORE"
},
"duration": 51,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-09-07T14:51:41.135+08:00",
"traceId": "5962f337662d4043"
}
