Description
You can call this operation to modify a database.
Call description
Prerequisites
You have passed the authentication for the OCP application service.
You have the Update permission on the specified tenant.
Request path
PUT /api/v2/ob/clusters/{id}/tenants/{tenantId}/databases/{dbName}
Request parameters
Path parameters
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| id | Integer | Yes | 1 | The ID of the cluster. |
| tenantId | Integer | Yes | 5 | The ID of the tenant. |
| dbName | String | Yes | db1 | The name of the database. |
Request body parameters
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| collation | String | No | utf8mb4_general_ci | The collation. Valid values: * binary * utf8mb4 * gbk * gb18030 Default value: utf8mb4_general_ci. This parameter is invalid for Oracle tenants. |
| primaryZone | String | No | zone1;zone2,zone3 | The priorities of the zones. |
| readonly | Boolean | Yes | false | Specifies whether the database is read-only. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| data | Object | The database object. For more information about the data structure, see the following table. |
| successful | Boolean | Indicates whether the request was 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. This trace ID is used for troubleshooting. |
| server | String | The address of the application server that responded to the request. |
Data structure of the database information
| Parameter | Type | Description |
|---|---|---|
| dbName | String | The name of the database. |
| charset | String | The character set. |
| collation | String | The collation. |
| primaryZone | String | The priorities of the zones. |
| readonly | Boolean | Indicates whether the database was read-only. |
| createTime | Datetime | The creation time. |
| connectionUrls | Array | The list of OBProxies and connection strings. |
| ├─ connectionStringType | String | The type of the connection string. Valid values: * OBPROXY * DIRECT |
| ├─ obProxyAddress | String | The IP address of the OBProxy. This parameter is valid only when the type of the connection string is OBPROXY. |
| ├─ obProxyPort | Integer | The port number of the OBProxy. This parameter is valid only when the type of the connection string is OBPROXY. |
| ├─ connectionString | String | The connection string. |
| requiredSize | Integer | The required size of the database. |
| id | Integer | The ID of the database. |
Examples
Sample request
Modify Database db1 in Tenant 1000001 of Cluster 1.
PUT /api/v2/ob/clusters/1/tenants/1000001/databases/db1?id=1&tenantId=1000001&dbName=db1
{
"collation": "utf8mb4_general_ci",
"readonly": false,
"primaryZone": "zone1"
}
Sample response
{
"data": {
"charset": "utf8mb4",
"collation": "utf8mb4_general_ci",
"createTime": "2021-09-07T10:50:04.194771+08:00",
"dbName": "db1",
"id": 1100611139404828,
"primaryZone": "zone1",
"readonly": false
},
"duration": 243,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-09-07T10:51:25.471+08:00",
"traceId": "c5b64d9caac441f8"
}