更新时间:2024-06-14 GMT+08:00

查询数据库列表

功能介绍

查询指定实例中的数据库列表。

URI

GET https://{Endpoint}/v3/{project_id}/instances/{instance_id}/databases

表1 参数说明

参数

是否必选

参数类型

描述

project_id

String

租户在某一Region下的项目ID。

获取方法请参见获取项目ID

instance_id

String

实例ID。

offset

Integer

分页符。从第一条数据偏移offset页数据后开始查询,默认为0(偏移0页数据,表示从第一条数据开始查询),必须为数字,不能为负数。例如:该参数指定为1,limit指定为10,则只展示第11~20条数据。

limit

Integer

每页显示的条目数量,取值范围[1, 100],默认10。

请求参数

无。

响应参数

表2 参数说明

参数

参数类型

描述

databases

Array of objects

列表中每个元素表示一个数据库。详情参见表3

total_count

Integer

总记录数。

表3 databases字段数据结构说明

参数

参数类型

描述

name

String

数据库名称。

owner

String

数据库所属用户。

character_set

String

数据库使用的字符集,例如UTF8。

collate_set

String

数据库排序集,例如en_US.UTF-8等。

size

String

数据库大小。

datctype

String

数据库使用的字符分类,例如en_US.UTF-8等。

compatibility_type

String

数据库兼容的类型,如GaussDB,M。

请求示例

查询数据库列表。

GET https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/{instance_id}/databases

响应示例

查询数据库列表成功。

{
    "databases": [
        {
            "name": "gaussdb_test",
            "owner": "root",
            "size": "25 MB",
            "datctype": "en_US.UTF-8",
            "character_set": "UTF8",
            "collate_set": "en_US.UTF-8",
            "compatibility_type": "GaussDB"
        },
        {
            "name": "gaussdb_test1",
            "owner": "root",
            "size": "25 MB",
            "datctype": "en_US.UTF-8",
            "character_set": "UTF8",
            "collate_set": "en_US.UTF-8",
            "compatibility_type": "GaussDB"
        },
        {
            "name": "gaussdb_test2",
            "owner": "root",
            "size": "25 MB",
            "datctype": "en_US.UTF-8",
            "character_set": "UTF8",
            "collate_set": "en_US.UTF-8",
            "compatibility_type": "GaussDB"
        }
    ],
    "total_count": 3
}

状态码

错误码

请参见错误码