Queries information about databases in a specified PolarDB cluster.

Debugging

Alibaba Cloud provides OpenAPI Explorer to simplify API usage. OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeDatabases

The operation that you want to perform. Set the value to DescribeDatabases.

DBClusterId String Yes pc-**************

The ID of the cluster.

DBName String No test_db

The name of the database that you want to query.

Note You can specify only one database.
PageNumber Integer No 1

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

PageSize Integer No 30

The number of entries to return on each page. Valid values:

  • 30
  • 50
  • 100

Default value: 30.

Response parameters

Parameter Type Example Description
PageRecordCount Integer 1

The number of entries returned per page.

Databases Array of Database

The information about databases.

Database
DBDescription String test_des

The description of the database.

DBStatus String Running

The state of the database. Valid values:

  • Creating: The database is being created.
  • Running: The database is running.
  • Deleting: The database is being deleted.
DBName String test_db

The name of the database.

Engine String MySQL

The engine that the database runs. Valid values:

  • MySQL
  • Oracle
  • PostgreSQL
CharacterSetName String utf8mb4

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

Accounts Array of Account

The accounts that can be used to access the database.

Note If you run the MySQL database engine on the cluster, the cluster does not support privileged accounts.
Account
PrivilegeStatus String Empowered

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.
AccountStatus String Available

The state of the account. Valid values:

  • Creating: The account is being created.
  • Available: The account is available.
  • Deleting: The account is being deleted.
AccountPrivilege String ReadOnly

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

  • ReadWrite: The account is granted the read and write permissions on the database.
  • ReadOnly: The account is granted the read-only permissions on the database.
  • 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.
AccountName String test_acc

The username of the account.

Note If you run the MySQL database engine on the cluster, the cluster does not support privileged accounts.
RequestId String E1DF8CA6-2300-448B-9ABF-760C4B******

The ID of the request.

PageNumber Integer 1

The page number of the returned page.

Examples

Sample requests

http(s)://polardb.aliyuncs.com/?Action=DescribeDatabases
&DBClusterId=pc-**************
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeDatabasesResponse>
<PageRecordCount>1</PageRecordCount>
<Databases>
    <Database>
        <DBName>test_db</DBName>
        <CharacterSetName>utf8mb4</CharacterSetName>
        <DBStatus>Running</DBStatus>
        <Engine>MySQL</Engine>
        <DBDescription>test_des</DBDescription>
    </Database>
    <Database>
        <Accounts>
            <Account>
                <AccountStatus>Available</AccountStatus>
                <AccountPrivilege>ReadOnly</AccountPrivilege>
                <PrivilegeStatus>Empowered</PrivilegeStatus>
                <AccountName>test_acc</AccountName>
            </Account>
        </Accounts>
    </Database>
</Databases>
<RequestId>E1DF8CA6-2300-448B-9ABF-760C4B******</RequestId>
<PageNumber>1</PageNumber>
</DescribeDatabasesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

For a list of error codes, visit the API Error Center.