Overview
You can call this API to create a physical backup task or a logical backup task for a database or table.
Notice
- Table-level backup (backupObjectType=table)
- You can select only one database.
- You must specify the tables to be backed up, with a maximum of 200 tables.
- Database-level backup (backupObjectType=database)
- You can select multiple databases.
- All tables under the selected databases are automatically backed up. The total number of tables across all selected databases cannot exceed 200.
- The tables field is not required in the databaseTables parameter.
API details
Constraints
The caller must have an AccessKey for accessing the multi-cloud API. For information about how to obtain the AccessKey ID and AccessKey secret, see Manage AccessKeys.
Request path
POST /api/v2/instances/{instanceId}/backup/data/start
Request parameters
Path
| Parameter | Type | Required | Description |
|---|---|---|---|
| instanceId | String | Yes | The ID of the instance. |
Body
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
| needprecheck | String | No | Specifies whether to perform a precheck. | true |
| backupobjecttype | String | Yes | The type of the backup object. | tenant |
| backuppolicy | String | Yes | The backup policy. | manual |
| tenantid | String | No | The ID of the tenant. | txxx |
Response parameters
| Parameter | Type | Description | Example value |
|---|---|---|---|
| backupTaskId | String | The ID of the backup task. | bak-******** |
Examples
Request example
curl --digest -u 'ak:sk' \
-X POST \
'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/backup/data/start' \
-H "Content-Type: application/json" \
--data '{
"needPreCheck":"true",
"backupObjectType":"tenant",
"backupPolicy":"manual",
"tenantId":"txxx"
}'
Response example
JSON format
{
"data":{"backupTaskId":"bak-********"},
"requestId":"7f6dba83-871a-4ff2-966d-c69f885ae559",
"success":true
}
Request parameters
Path
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
| instanceId | String | Yes | The ID of the instance. | obxxx |
Body
| Parameter | Type | Required | Description | Example value |
|---|---|---|---|---|
| backupObjectType | String | Yes | The type of the backup object. Valid values:
|
database |
| tenantId | String | Yes | The ID of the tenant. | txxx |
| databaseTables | Array<DatabaseTable> |
Yes | The array of database and table information. For more information, see the following table. | - |
| - database | String | Yes | The name of the database. | database1 |
| - tables | Array<String> |
No | The list of table names. This parameter is required for table-level backups but not for database-level backups. | ["test1", "test2", "test3"] |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| success | Boolean | Indicates whether the request was successful. |
| data | Object | The returned data. |
| requestId | String | The ID of the request. |
Examples
Request example
Example 1: Table-level backup
curl --location 'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/backup/data/start' \
--digest -u 'ak:sk' \
--header 'Content-Type: application/json' \
--data '{
"instanceId": "obxxx",
"backupObjectType": "table",
"tenantId": "txxx",
"databaseTables": [
{
"database": "database1",
"tables": ["test1", "test2", "test3"]
}
]
}'
Example 2: Database-level backup (multiple databases)
curl --location 'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/backup/data/start' \
--digest -u 'ak:sk' \
--header 'Content-Type: application/json' \
--data '{
"instanceId": "obxxx",
"backupObjectType": "database",
"tenantId": "txxx",
"databaseTables": [
{
"database": "database1"
},
{
"database": "database2"
}
]
}'
Response example
JSON format
{
"success": true,
"data": {},
"requestId": "req-20260113-123456"
}