You can call the DescribeDatabases operation to query the information about the databases of an instance.

Note If the specified request parameters are invalid, no database information is returned.

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

Parameter Type Required Example Description
Action String Yes DescribeDatabases

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

DBInstanceId String Yes rm-uf6wjk5xxxxxxx

The ID of the instance.

DBName String No testDB01

The name of the database.

DBStatus String No Creating

The status of the database. Valid values:

  • Creating
  • Running
  • Deleting
PageSize Integer No 30

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

  • 30
  • 50
  • 100

Default value: 30.

PageNumber Integer No 1

The number of the page to return. Valid values: any non-zero positive integer.

Default value: 1.

ResourceGroupId String No rg-acfmy*****

The ID of the resource group.

Response parameters

Parameter Type Example Description
RequestId String 2603CA96-B17D-4903-BC04-61A2C829CD94

The ID of the request.

Databases Array of Database

An array that consists of the information about databases.

Database
DBDescription String Test database

The description of the database.

DBStatus String Creating

The status of the database. Valid values:

  • Creating
  • Running
  • Deleting
DBName String testDB01

The name of the database.

DBInstanceId String rm-uf6wjk5xxxxxxx

The ID of the instance to which the database belongs.

Engine String MySQL

The database engine of the instance to which the database belongs.

CharacterSetName String utf8

The name of the character set.

Collate String C

The collation of the character set. The example value C stands for localization.

Note This parameter is returned only for instances that run PostgreSQL.
Ctype String en_US.utf8

The type of the character set.

Note This parameter is returned only for instances that run PostgreSQL.
ConnLimit String -1

The limit on the number of concurrent requests. The value -1 indicates that the number of concurrent requests is unlimited.

Note This parameter is returned only for instances that run PostgreSQL.
Tablespace String pg_default

The tablespace of the database.

Note This parameter is returned only for instances that run PostgreSQL.
ResourceGroupId String rg-acfmy*****

The ID of the resource group.

Accounts Array of AccountPrivilegeInfo

An array that consists of the details of the accounts. Each account has specific permissions on the database.

AccountPrivilegeInfo
Account String test

The username of the account.

AccountPrivilege String DMLOnly

The permissions that the account has on the database. Valid values:

  • ReadWrite: read and write permissions
  • ReadOnly: read-only permissions
  • DMLOnly: DML-only permissions
  • DDLOnly: DDL-only permissions
AccountPrivilegeDetail String SELECT

The details of the permissions that the account has on the database.

PageNumber Integer 1

The reserved parameter.

PageSize Integer 30

The reserved parameter.

TotalCount Integer 100

The total number of entries returned.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=DescribeDatabases
&DBInstanceId=rm-uf6wjk5xxxxxxx
&<Common request parameters>

Sample success responses

XML format

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

<?xml version="1.0" encoding="UTF-8" ?>
<DescribeDatabasesResponse>
    <RequestId>2603CA96-B17D-4903-BC04-61A2C829CD94</RequestId>
    <Databases>
        <Database>
            <Engine>MySQL</Engine>
            <CharacterSetName>utf8</CharacterSetName>
            <DBStatus>Creating</DBStatus>
            <DBDescription></DBDescription>
            <DBInstanceId>rdsaiiabnaiiabn</DBInstanceId>
            <Accounts></Accounts>
            <DBName>testdb</DBName>
        </Database>
        <Database>
            <Engine>MySQL</Engine>
            <CharacterSetName>gbk</CharacterSetName>
            <DBStatus>Creating</DBStatus>
            <DBDescription></DBDescription>
            <DBInstanceId>rdsaiiabnaiiabn</DBInstanceId>
            <Accounts></Accounts>
            <DBName>testdb2</DBName>
        </Database>
    </Databases></DescribeDatabasesResponse>

JSON format

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

{
  "RequestId" : "2603CA96-B17D-4903-BC04-61A2C829CD94",
  "Databases" : {
    "Database" : [ {
      "Engine" : "MySQL",
      "CharacterSetName" : "utf8",
      "DBStatus" : "Creating",
      "DBDescription" : "",
      "DBInstanceId" : "rdsaiiabnaiiabn",
      "Accounts" : {
        " AccountPrivilegeInfo" : [ ]
      },
      "DBName" : "testdb"
    }, {
      "Engine" : "MySQL",
      "CharacterSetName" : "gbk",
      "DBStatus" : "Creating",
      "DBDescription" : "",
      "DBInstanceId" : "rdsaiiabnaiiabn",
      "Accounts" : {
        " AccountPrivilegeInfo" : [ ]
      },
      "DBName" : "testdb2"
    } ]
  }
}

Error codes

HTTP status code Error code Error message Description
400 Database.ConnectError Database connect error. please check instance status and database processlist The error message returned because the database connection is abnormal. Check the instance status and the connection pool of the database.
400 Database.QueryError Query Db failed, please check input value and instance status The error message returned because the database fails to be queried. Check the input parameters and the instance status.

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