All Products
Search
Document Center

PolarDB:DescribeDatabases

Last Updated:Oct 10, 2024

Queries the information about databases in a PolarDB cluster.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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
polardb:DescribeDatabasesget
  • DBCluster
    acs:polardb:{#regionId}:{#accountId}:dbcluster/{#DbClusterId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DBClusterIdstringYes

The ID of the cluster.

pc-**************
DBNamestringNo

The name of the database.

Note You cannot specify multiple database names.
test_db
PageNumberintegerNo

The page number. The value must be a positive integer that does not exceed the maximum value of the INTEGER data type. Default value: 1.

1
PageSizeintegerNo

The number of entries per page. Valid values:

  • 30
  • 50
  • 100

Default value: 30.

30

Response parameters

ParameterTypeDescriptionExample
object
PageRecordCountinteger

The number of entries per page.

1
Databasesarray<object>

Details about databases.

Databaseobject
DBDescriptionstring

The description of the database.

test_des
DBStatusstring

The state of the database. Valid values:

  • Creating
  • Running
  • Deleting
Running
DBNamestring

The name of the database.

test_db
Enginestring

The type of the database engine. Valid values:

  • MySQL
  • Oracle
  • PostgreSQL
MySQL
MasterIDstring

The ID of the primary node in the cluster of Multi-master Cluster (Database/Table) Edition.

2
CharacterSetNamestring

The character set that the database uses. For more information, see Character set tables.

utf8mb4
Accountsarray<object>

Details about the accounts.

Note A PolarDB for MySQL cluster does not support privileged accounts.
Accountobject
PrivilegeStatusstring

The authorization state of the account. Valid values:

  • Empowering: The system is granting permissions to the account.
  • Empowered: Permissions are granted to the account.
  • Removing: The system is revoking permissions from the account.
Empowered
AccountStatusstring

The state of the account. Valid values:

  • Creating
  • Available
  • Deleting
Available
AccountPrivilegestring

The permissions that are granted to the account. Valid values:

  • ReadWrite: read and write permissions
  • ReadOnly: read-only permissions
  • DMLOnly: The account is granted the permissions to execute only DML statements on the database.
  • DDLOnly: The account is granted the permissions to execute only DDL statements on the database.
  • ReadIndex: The account has the read and index permissions on the database.
ReadOnly
AccountNamestring

The username of the account.

Note A PolarDB for MySQL cluster does not support privileged accounts.
test_acc
RequestIdstring

The ID of the request.

E1DF8CA6-2300-448B-9ABF-760C4B******
PageNumberinteger

The page number.

1

Examples

Sample success responses

JSONformat

{
  "PageRecordCount": 1,
  "Databases": {
    "Database": [
      {
        "DBDescription": "test_des",
        "DBStatus": "Running",
        "DBName": "test_db",
        "Engine": "MySQL",
        "MasterID": "2",
        "CharacterSetName": "utf8mb4",
        "Accounts": {
          "Account": [
            {
              "PrivilegeStatus": "Empowered",
              "AccountStatus": "Available",
              "AccountPrivilege": "ReadOnly",
              "AccountName": "test_acc"
            }
          ]
        }
      }
    ]
  },
  "RequestId": "E1DF8CA6-2300-448B-9ABF-760C4B******",
  "PageNumber": 1
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidDBClusterId.MalformedThe specified parameter DBClusterId is not valid.The specified DBClusterId parameter is invalid.
400InvalidPageSize.MalformedThe specified parameter PageSize is not valid.The specified PageSize parameter is invalid.
400InvalidPageNumber.MalformedThe specified parameter PageNumber is not valid.The specified PageNumber parameter is invalid.
400Database.ConnectErrordb instance %s connect failed, please check instance status and database processlistFailed to connect to the database cluster. Check the cluster status and database process list.
404InvalidDBCluster.NotFoundThe DBClusterId provided does not exist in our records.The specified DBClusterId parameter does not exist in the current record.
404InvalidDBClusterId.NotFoundThe DBInstanceId provided does not exist in our records.The specified DBClusterId parameter does not exist in the current record.

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

Change history

Change timeSummary of changesOperation
2023-09-12The Error code has changedView Change Details