Queries information about databases in a specified PolarDB cluster.

Debugging

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

ParameterTypeRequiredExampleDescription
ActionStringYesDescribeDatabases

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

DBClusterIdStringYespc-**************

The ID of the cluster.

DBNameStringNotest_db

The name of the database.

Note You can specify only one database.
PageNumberIntegerNo1

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.

PageSizeIntegerNo30

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

  • 30
  • 50
  • 100

Default value: 30.

Response parameters

ParameterTypeExampleDescription
PageRecordCountInteger1

The number of entries returned per page.

DatabasesArray of Database

Details about databases.

Database
DBDescriptionStringtest_des

The description of the database.

DBStatusStringRunning

The state of the database. Valid values:

  • Creating
  • Running
  • Deleting
DBNameStringtest_db

The name of the database.

EngineStringMySQL

The type of the database engine. Valid values:

  • MySQL
  • Oracle
  • PostgreSQL
MasterIDString2

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

CharacterSetNameStringutf8mb4

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

AccountsArray of Account

Details about accounts.

Note For a PolarDB for MySQL cluster, privileged accounts are not included.
Account
PrivilegeStatusStringEmpowered

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.
AccountStatusStringAvailable

The state of the account. Valid values:

  • Creating
  • Available
  • Deleting
AccountPrivilegeStringReadOnly

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.
AccountNameStringtest_acc

The name of the account.

Note For a PolarDB for MySQL cluster, privileged accounts are not included.
RequestIdStringE1DF8CA6-2300-448B-9ABF-760C4B******

The ID of the request.

PageNumberInteger1

The page number of the returned page.

Examples

Sample requests

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

Sample success response

XML format

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

<DescribeDatabasesResponse>
    <PageRecordCount>1</PageRecordCount>
    <Databases>
        <DBDescription>test_des</DBDescription>
        <DBStatus>Running</DBStatus>
        <DBName>test_db</DBName>
        <Engine>MySQL</Engine>
        <MasterID>2</MasterID>
        <CharacterSetName>utf8mb4</CharacterSetName>
        <Accounts>
            <PrivilegeStatus>Empowered</PrivilegeStatus>
            <AccountStatus>Available</AccountStatus>
            <AccountPrivilege>ReadOnly</AccountPrivilege>
            <AccountName>test_acc</AccountName>
        </Accounts>
    </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" : [ {
    "DBDescription" : "test_des",
    "DBStatus" : "Running",
    "DBName" : "test_db",
    "Engine" : "MySQL",
    "MasterID" : "2",
    "CharacterSetName" : "utf8mb4",
    "Accounts" : [ {
      "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 error message returned because the specified DBClusterId parameter is invalid.
400InvalidPageSize.MalformedThe specified parameter PageSize is not valid.The error message returned because the specified PageSize parameter is invalid.
400InvalidPageNumber.MalformedThe specified parameter PageNumber is not valid.The error message returned because the specified PageNumber parameter is invalid.
400Database.ConnectErrordb instance %s connect failed, please check instance status and database processlistThe error message returned because the cluster %s is not connected. Check the cluster status and database process list.
404InvalidDBCluster.NotFoundThe DBClusterId provided does not exist in our records.The error message returned because the specified cluster ID does not exist in the current record.

For a list of error codes, see Service error codes.