调用DescribeSqlLogTask接口,查询DAS企业版离线任务详情。
接口说明
使用该接口需满足以下前提条件:
使用阿里云或 DAS 的 SDK 时,建议使用最新版本。
在使用 SDK 调用 DAS 服务时,需要将地域指定为 cn-shanghai。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
hdm:DescribeSqlLogTask |
get |
*全部资源
|
无 | 无 |
请求参数
名称 |
类型 |
必填 |
描述 |
示例值 |
InstanceId |
string |
否 |
数据库实例 ID。 |
r-bp1nti25tc7bq5**** |
TaskId |
string |
否 |
任务 ID。 |
a4f5c4494dbd6713185d87a97aa53e8 |
PageNo |
integer |
否 |
分页查询的页码,从 1 开始,默认为 1。 |
1 |
PageSize |
integer |
否 |
分页查询每页最大记录数,最大支持 100,默认为 10。 |
10 |
返回参数
名称 |
类型 |
描述 |
示例值 |
object |
|||
Code |
string |
返回的状态码。 |
200 |
Message |
string |
请求返回消息。 说明
请求成功时该参数返回 Successful,请求失败时会返回请求异常信息(如错误码等)。 |
Successful |
RequestId |
string |
请求 ID。 |
B6D17591-B48B-4D31-9CD6-9B9796B2**** |
Success |
string |
请求是否执行成功:
|
true |
Data |
object |
返回数据。 |
|
Name |
string |
任务名称。 |
SQL审计导出1 |
TaskId |
string |
任务 ID。 |
9a4f5c4494dbd6713185d87a97aa53e8 |
TaskType |
string |
任务类型。
|
Query |
CreateTime |
integer |
任务创建时间,格式为 unix 时间戳,单位为毫秒。 |
1681363254423 |
Status |
string |
任务状态。
说明
当任务处于 COMPLETED 时,可以查看离线任务的结果。 |
COMPLETED |
Expire |
boolean |
任务是否过期。
|
false |
Start |
integer |
查询开始时间,格式为 unix 时间戳,单位为毫秒。 |
1596177993000 |
End |
integer |
查询结束时间,格式为 unix 时间戳,单位为毫秒。 |
1608888296000 |
Filters |
array |
过滤条件。 |
|
object |
查询筛选条件。 |
||
Key |
string |
过滤参数的名称。 说明
支持的过滤参数及其取值请参考返回参数补充说明。 |
keyWords |
Value |
any |
过滤参数的值。 |
select |
Total |
integer |
任务总数。 |
1 |
Queries |
array |
离线查询任务结果。 当 TaskType == Query 时才会返回该值。 |
|
object |
离线查询任务结果。 |
||
Vip |
string |
查询链接的 endpoint 解析地址。 |
10.146.XX.XX |
NodeId |
string |
子节点 ID。 |
pi-bp1o58x3ib7e6**** |
SqlText |
string |
SQL 语句详情。 |
SELECT @@session.transaction_read_only |
SqlType |
string |
选择 SQL 的类型。取值:
|
SELECT |
State |
string |
执行结果。
|
0 |
DBName |
string |
数据库名称。 |
testdb01 |
SqlId |
string |
SQL ID。 |
a4111670e80596c5bf42cf5154438a91 |
ExecuteTime |
string |
执行时间,格式为 UTC 时间: |
2023-12-07T02:15:32Z |
OriginTime |
integer |
执行时间戳,格式为 Unix 时间,单位为毫秒。 |
1701886532000 |
AccountName |
string |
数据库账号。 |
testname |
HostAddress |
string |
客户端 IP 地址。 |
11.197.XX.XX |
Consume |
integer |
执行耗时,单位毫秒。 |
58 |
LockTime |
integer |
锁等待时间,单位毫秒。 |
0 |
UpdateRows |
integer |
更新行数。 |
0 |
ScanRows |
integer |
扫描行数。 |
0 |
ReturnRows |
integer |
返回行数。 |
0 |
LogicRead |
integer |
逻辑读。 |
0 |
PhysicSyncRead |
integer |
物理同步读。 |
0 |
PhysicAsyncRead |
integer |
物理异步读。 |
0 |
ThreadId |
integer |
线程 ID。 |
None |
TrxId |
string |
事务 ID。 |
200000 |
Ext |
string |
扩展信息字段,备用参数。 |
None |
Scnt |
integer |
PolarDB-X 2.0 计算节点(CN)的 DN 请求数。 |
10 |
Rows |
integer |
PolarDB-X 2.0 数据库实例计算节点总更新或返回的行数。 |
10 |
Frows |
integer |
PolarDB-X 2.0 计算节点(CN)的拉取行数。 |
10 |
TraceId |
string |
PolarDB-X 2.0 的跟踪 ID,即 SQL 在数据节点的执行 ID。 |
14c93b7c7bf00000 |
UseImciEngine |
string |
PolarDB MySQL 版实例是否使用列存索引。
|
true |
ParallelDegree |
string |
PolarDB MySQL 版实例的并行排队时间,单位为毫秒。 |
10 |
ParallelQueueTime |
string |
PolarDB MySQL 版实例的并行度。 |
2 |
PhysicRead |
integer |
物理读。 |
0 |
CpuTime |
integer |
CPU 执行时间,单位为微秒。 |
100 |
Writes |
integer |
RDS SQL Server 引擎的写入数。 |
10 |
Collection |
string |
预留参数 |
None |
SqlCommand |
integer |
||
Export |
string |
导出任务的下载地址。当 TaskType == Export 时才会返回该值。 |
"https://das-sqllog-download-cn-hongkong.oss-cn-hongkong.aliyuncs.com/****" |
Key 支持的参数和取值:
KeyWords:关键字,多个关键字间使用空格隔开。
LogicalOperator:关键字间的逻辑操作,取值为 and 或 or。
AccountName:用户名,可以传递多个的,用逗号分开,上限为 5。
dbName:数据库名称,可以传递多个的,用逗号分开,上限为 5。
HostAddress:客户端 IP 地址,可以传递多个的,用逗号分开,上限为 5。
MaxConsume:最大耗时,单位 us。
MinConsume:最小耗时,单位 us。
MaxScanRows:最大扫描行。
MinScanRows:最小扫描行。
SqlType:SQL 类型,取值 select、update、insert 或 delete。
State:执行结果,取值 0(成功)或 1(失败)。
ThreadId:线程 ID。
SortKey:排序列名称,取值 ScanRows(扫描行数)、UpdateRows(更新行数)、Consume(耗时)、ExecuteTime(执行时间)、ReturnRows(返回行数)、LockTime(锁等待时间)、Frows(PolarDB-X 2.0 计算节点的拉取行数)、Scnt(PolarDB-X 2.0 计算节点的 DN 请求数)、CpuTime(CPU 执行时间)、PhysicalRead(物理读)。
SortMethod:排序方式,取值 DESC(降序)、ASC(升序)。默认为 DESC。
TraceId:PolarDB-X 2.0 实例的跟踪 ID。
MinRows:最小更新行数。
MaxRows:最大更新行数。
MinScnt:PolarDB-X 2.0 计算节点(CN)的 DN 最小请求数。
MaxScnt:PolarDB-X 2.0 计算节点(CN)的 DN 最大请求数。
TrxId:事务 ID。
Fail:错误码。
SqlId:SQL ID。
示例
正常返回示例
JSON
格式
{
"Code": "200",
"Message": "Successful",
"RequestId": "B6D17591-B48B-4D31-9CD6-9B9796B2****",
"Success": "true",
"Data": {
"Name": "SQL审计导出1\n",
"TaskId": "9a4f5c4494dbd6713185d87a97aa53e8\n",
"TaskType": "Query",
"CreateTime": 1681363254423,
"Status": "COMPLETED",
"Expire": true,
"Start": 1596177993000,
"End": 1608888296000,
"Filters": [
{
"Key": "keyWords\n",
"Value": "select"
}
],
"Total": 1,
"Queries": [
{
"Vip": "10.146.XX.XX",
"NodeId": "pi-bp1o58x3ib7e6****\n",
"SqlText": "SELECT @@session.transaction_read_only",
"SqlType": "SELECT",
"State": "0",
"DBName": "testdb01",
"SqlId": "a4111670e80596c5bf42cf5154438a91",
"ExecuteTime": "2023-12-07T02:15:32Z",
"OriginTime": 1701886532000,
"AccountName": "testname\n",
"HostAddress": "11.197.XX.XX\n",
"Consume": 58,
"LockTime": 0,
"UpdateRows": 0,
"ScanRows": 0,
"ReturnRows": 0,
"LogicRead": 0,
"PhysicSyncRead": 0,
"PhysicAsyncRead": 0,
"ThreadId": 0,
"TrxId": "200000\n",
"Ext": "None",
"Scnt": 10,
"Rows": 10,
"Frows": 10,
"TraceId": "14c93b7c7bf00000 ",
"UseImciEngine": "true\n",
"ParallelDegree": "10\n",
"ParallelQueueTime": "2",
"PhysicRead": 0,
"CpuTime": 100,
"Writes": 10,
"Collection": "None",
"SqlCommand": 0
}
],
"Export": "\"https://das-sqllog-download-cn-hongkong.oss-cn-hongkong.aliyuncs.com/****\""
}
}
错误码
HTTP status code |
错误码 |
错误信息 |
描述 |
---|---|---|---|
400 | InvalidParams | The request parameters are invalid. | |
403 | NoPermission | You are not authorized to do this action. |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。