Queries the information about databases.

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 SearchDatabase

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

Tid Long Yes 3***

The ID of the tenant. You can call the GetUserActiveTenant operation to obtain the tenant ID.

SearchKey String Yes testdb

The keyword that is used to search for databases.

PageNumber Integer Yes 1

The number of the page to return.

PageSize Integer No 10

The number of entries to return on each page.

EnvType String No test

The type of the environment to which the database belongs. For more information, see Change the environment type of an instance.

SearchRange String No HAS_PERMSSION

The query range based on permissions. Valid values:

  • HAS_PERMSSION: searches for databases on which the current user has permissions.
  • OWNER: searches for databases owned by the current user.
  • MY_FOCUS: searches for databases that the current user follows.
  • UNKNOWN: searches for all databases.
SearchTarget String No SINGLE_DB

The category of the database. Valid values:

  • DB: single database or logical database.
  • SINGLE_DB: single database.
  • LOGIC_DB: logical database.
DbType String No MYSQL

The type of the database. For more information about the valid values of this parameter, see DbType parameter.

RegionId String No cn-hangzhou

The ID of the region in which Data Management (DMS) is activated. For more information about the valid values of this parameter, see RegionID parameter.

Response parameters

Parameter Type Example Description
TotalCount Long 1

The total number of entries returned.

RequestId String E0D21075-CD3E-4D98-8264-FD8AD04A63B6

The ID of the request.

SearchDatabaseList Array of SearchDatabase

The information about the databases.

SearchDatabase
DatabaseId String 2528****

The ID of the database.

Host String rm-xxxx.mysql.rds.aliyuncs.com

The endpoint of the instance in which the database resides.

DbaId String 10****

The ID of the user who assumes the database administrator (DBA) role.

SchemaName String test

The name of the database.

Logic Boolean false

Indicates whether the database is a logical database. Valid values:

  • true: The database is a logical database.
  • false: The database is not a logical database.
DatalinkName String datalink_name

The name of the data link for cross-database queries.

Port Integer 3306

The port number of the instance in which the database resides.

EnvType String test

The type of the environment to which the database belongs. For more information, see Change the environment type of an instance.

Sid String testSid

The system ID (Sid) of the instance in which the database resides.

OwnerIdList Array of String 1

The IDs of the owners of the database.

Encoding String utf8

The encoding method of the database.

DbType String mysql

The type of the database.

OwnerNameList Array of String user1

The nicknames of the database owners.

SearchName String test@xxx.xxx.xxx.xxx:3306

The name that is used to search for the database.

Alias String test_rds

The alias of the database.

ErrorCode String UnknownError

The error code returned.

ErrorMessage String UnknownError

The error message returned.

Success Boolean true

Indicates whether the request was successful. Valid values:

  • true: The request was successful.
  • false: The request failed.

Examples

Sample request

http(s)://dms-enterprise.aliyuncs.com/?Action=SearchDatabase
&Tid=3***
&SearchKey=testdb
&PageNumber=1
&PageSize=10
&EnvType=test
&SearchRange=HAS_PERMSSION
&SearchTarget=SINGLE_DB
&DbType=MYSQL
&<Common request parameters>

Sample success responses

XML format

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

<SearchDatabaseResponse>
    <TotalCount>1</TotalCount>
    <RequestId>E0D21075-CD3E-4D98-8264-FD8AD04A63B6</RequestId>
    <SearchDatabaseList>
        <DatabaseId>2528****</DatabaseId>
        <Host>rm-xxxx.mysql.rds.aliyuncs.com</Host>
        <DbaId>10****</DbaId>
        <SchemaName>test</SchemaName>
        <Logic>false</Logic>
        <DatalinkName>datalink_name</DatalinkName>
        <Port>3306</Port>
        <EnvType>test</EnvType>
        <Sid>testSid</Sid>
        <OwnerIdList>1</OwnerIdList>
        <Encoding>utf8</Encoding>
        <DbType>mysql</DbType>
        <OwnerNameList>user1</OwnerNameList>
        <SearchName>test@xxx.xxx.xxx.xxx:3306</SearchName>
        <Alias>test_rds</Alias>
    </SearchDatabaseList>
    <Success>true</Success>
</SearchDatabaseResponse>

JSON format

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

{
  "TotalCount" : 1,
  "RequestId" : "E0D21075-CD3E-4D98-8264-FD8AD04A63B6",
  "SearchDatabaseList" : [ {
    "DatabaseId" : "2528****",
    "Host" : "rm-xxxx.mysql.rds.aliyuncs.com",
    "DbaId" : "10****",
    "SchemaName" : "test",
    "Logic" : false,
    "DatalinkName" : "datalink_name",
    "Port" : 3306,
    "EnvType" : "test",
    "Sid" : "testSid",
    "OwnerIdList" : [ "1" ],
    "Encoding" : "utf8",
    "DbType" : "mysql",
    "OwnerNameList" : [ "user1" ],
    "SearchName" : "test@xxx.xxx.xxx.xxx:3306",
    "Alias" : "test_rds"
  } ],
  "Success" : true
}

Error codes

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