调用GetQueryOptimizeExecErrorStats接口,获取执行失败的模板数据。
- 使用阿里云或DAS的SDK时,建议使用最新版本。
- 在使用SDK调用DAS服务时,需要将地域指定为cn-shanghai。
- 本接口适用的数据库引擎为:
- RDS MySQL
- PolarDB MySQL
- RDS PostgreSQL
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | GetQueryOptimizeExecErrorStats |
系统规定参数。取值:GetQueryOptimizeExecErrorStats。 |
Engine | String | 是 | MySQL |
数据库引擎,取值:
|
InstanceIds | String | 否 | rm-2ze8g2am97624**** |
实例ID,多个实例ID间用逗号分隔。 |
Keywords | String | 否 | select update |
SQL文本关键词,多个关键词以空格分隔。 |
LogicalOperator | String | 否 | or |
多个SQL文本关键词逻辑关系,当前支持:
|
DbNames | String | 否 | testdb01 |
需要查询的数据库名。 |
Time | String | 是 | 1642953600000 |
查询数据的日期,格式为Unix时间戳,单位为毫秒。 |
PageSize | String | 是 | 10 |
分页查询每页数据量,默认为10。 |
PageNo | String | 是 | 1 |
分页查询的页码,从1开始,默认为1。 |
OrderBy | String | 否 | error_count |
排序字段,当前仅支持error_count(SQL执行错误次数)。 |
Asc | String | 否 | true |
是否升序排序,默认为true。
|
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Code | String | 200 |
返回的状态码。 |
Message | String | Successful |
请求返回消息。 |
Data | Object |
详细信息列表,包括信息总数、错误码等。 |
|
Total | Long | 19 |
总数据量。 |
PageNo | Integer | 1 |
页码。 |
PageSize | Integer | 10 |
每页数量。 |
Extra | String | None |
备用参数。 |
List | Array of QueryOptimizeExecErrorStats |
执行失败的模板数据列表。 |
|
InstanceId | String | rm-2ze8g2am97624**** |
实例ID。 |
InstanceName | String | 测试实例 |
实例别名。 |
Dbname | String | testdb01 |
数据库名。 |
SqlId | String | 2e8147b5ca2dfc640dfd5e43d96a**** |
SQL模板ID。 |
SqlText | String | select * from test1 |
执行错误的SQL文本。 |
ErrorCode | String | 1146 |
错误码。 |
ErrorCount | Long | 10 |
错误次数。 |
RequestId | String | B6D17591-B48B-4D31-9CD6-9B9796B2**** |
请求ID。 |
Success | String | true |
请求是否执行成功:
|
示例
请求示例
http(s)://das.cn-shanghai.aliyuncs.com/?Action=GetQueryOptimizeExecErrorStats
&Engine=MySQL
&InstanceIds=rm-2ze8g2am97624****
&Keywords=select update
&LogicalOperator=or
&DbNames=testdb01
&Time=1642953600000
&PageSize=10
&PageNo=1
&OrderBy=error_count
&Asc=true
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<GetQueryOptimizeExecErrorStatsResponse>
<Code>200</Code>
<Message>Successful</Message>
<Data>
<Total>19</Total>
<PageNo>1</PageNo>
<PageSize>10</PageSize>
<Extra>None</Extra>
<List>
<InstanceId>rm-2ze8g2am97624****</InstanceId>
<InstanceName>测试实例</InstanceName>
<Dbname>testdb01</Dbname>
<SqlId>2e8147b5ca2dfc640dfd5e43d96a****</SqlId>
<SqlText>select * from test1</SqlText>
<ErrorCode>1146</ErrorCode>
<ErrorCount>10</ErrorCount>
</List>
</Data>
<RequestId>B6D17591-B48B-4D31-9CD6-9B9796B2****</RequestId>
<Success>true</Success>
</GetQueryOptimizeExecErrorStatsResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"Code" : "200",
"Message" : "Successful",
"Data" : {
"Total" : 19,
"PageNo" : 1,
"PageSize" : 10,
"Extra" : "None",
"List" : [ {
"InstanceId" : "rm-2ze8g2am97624****",
"InstanceName" : "测试实例",
"Dbname" : "testdb01",
"SqlId" : "2e8147b5ca2dfc640dfd5e43d96a****",
"SqlText" : "select * from test1",
"ErrorCode" : "1146",
"ErrorCount" : 10
} ]
},
"RequestId" : "B6D17591-B48B-4D31-9CD6-9B9796B2****",
"Success" : "true"
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | InvalidParams | The request parameters are invalid. | 请求参数错误 |
访问错误中心查看更多错误码。