All Products
Search
Document Center

ApsaraDB for OceanBase:DescribeDatabases

Last Updated:Dec 02, 2024

You can call this operation to query databases in a tenant.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
oceanbase:DescribeDatabasesget
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
TenantIdstringYes

The ID of the tenant.

ob2mr3oae0****
PageNumberintegerNo

The number of the page returned.

  • Start value: 1
  • Default value: 1
1
PageSizeintegerNo

The number of rows returned on each page.

  • Maximum value: 100.
  • Default value: 10
10
DatabaseNamestringNo

The name of the database.
You cannot use reserved keywords, such as test and mysql.

sms_pre
SearchKeystringNo

The search keyword.

pay
WithTablesbooleanNo

Specifies whether to return the information about tables in the database. Default value: false.

Note The operation may time out if the database contains a large number of tables.
true
InstanceIdstringNo

The ID of the cluster.

ob****n0abo9uo

Response parameters

ParameterTypeDescriptionExample
object

The return result of the request.

TotalCountinteger

The total number of databases in the tenant.

1
Databasesarray<object>

The list of databases in the tenant.

Dataobject

The list of databases in the tenant.

Statusstring

The status of the database. Valid values:

  • ONLINE: The database is running.
  • DELETING: The database is being deleted.
ONLINE
Descriptionstring

The description of the database.

test db
Encodingstring

The encoding standard of the database. Encoding standards such as utf8mb4 and GBK are supported.

utf8mb4
DbTypestring

The database type.

mysql
DatabaseNamestring

The name of the database.

sms_pre
CreateTimestring

The time when the database was created.

2022-02-21 15:41:06
Usersarray<object>

The list of accounts that are granted privileges on this database.

Usersobject

The list of accounts that are granted privileges on this database.

UserTypestring

The type of the account. Valid values:

  • Admin: the super administrator account.
  • Normal: a general account.
Normal
Rolestring

The role of the account.
In MySQL mode, a role is a database-level role. Valid values:

  • ReadWrite: a role that has the read and write privileges, namely ALL PRIVILEGES.
  • ReadOnly: a role that has only the read-only privilege SELECT.
  • DDL: a role that has the DDL privileges such as CREATE, DROP, ALTER, SHOW VIEW, and CREATE VIEW.
  • DML: a role that has the DML privileges such as SELECT, INSERT, UPDATE, DELETE, and SHOW VIEW.
ReadOnly
UserNamestring

The name of the account.

user_pay_ro
Privilegesstring

If you have granted custom privileges on the database, this parameter indicates the custom privileges, separated by commas (,). Otherwise, no data is returned for this parameter.

select,delete,update
TenantIdstring

The ID of the tenant.

t33h8y08k****
Tablesarray<object>

The list of database tables.

Tablesobject

The list of database tables.

TableNamestring

The name of the database table.

testTables
RequiredSizedouble

The storage space required, in GB.

5.67 GB
DataSizedouble

The actual data size, in GB.

Notice This parameter is no longer used in later versions. RequiredSize is used instead.

5.67 GB
Collationstring

The collation.

utf8mb4_general_ci
InstanceIdstring

The ID of the cluster to which the tenant belongs.

obsdh2f****
TenantNamestring

The name of the tenant.

tenantABC
RequestIdstring

The ID of the request.

EE205C00-30E4-****-****-87E3A8A2AA0C

Examples

Sample success responses

JSONformat

{
  "TotalCount": 1,
  "Databases": [
    {
      "Status": "ONLINE",
      "Description": "test db",
      "Encoding": "utf8mb4",
      "DbType": "mysql",
      "DatabaseName": "sms_pre",
      "CreateTime": "2022-02-21 15:41:06",
      "Users": [
        {
          "UserType": "Normal",
          "Role": "ReadOnly",
          "UserName": "user_pay_ro",
          "Privileges": "select,delete,update"
        }
      ],
      "TenantId": "t33h8y08k****",
      "Tables": [
        {
          "TableName": "testTables"
        }
      ],
      "RequiredSize": 0,
      "DataSize": 0,
      "Collation": "utf8mb4_general_ci",
      "InstanceId": "obsdh2f****",
      "TenantName": "tenantABC"
    }
  ],
  "RequestId": "EE205C00-30E4-****-****-87E3A8A2AA0C"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-10-30The request parameters of the API has changed. The response structure of the API has changedView Change Details
2023-07-04The response structure of the API has changedView Change Details
2022-09-28The response structure of the API has changedView Change Details
2022-01-17The response structure of the API has changedView Change Details