All Products
Search
Document Center

Database Autonomy Service:DescribeSqlLogTask

Last Updated:Sep 25, 2024

Queries the details of an offline task in Database Autonomy Service (DAS) Enterprise Edition.

Operation description

Before you call this operation, take note of the following items:

  • If you use an Alibaba Cloud SDK or a DAS SDK to call this operation, we recommend that you use the latest version of the SDK.
  • If you use an SDK to call the API operations of DAS, you must set the region ID to cn-shanghai.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
hdm:DescribeSqlLogTaskget
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringNo

The ID of the database instance.

r-bp1nti25tc7bq5****
TaskIdstringNo

The task ID.

a4f5c4494dbd6713185d87a97aa53e8
PageNointegerNo

The page number. Pages start from page 1. Default value: 1.

1
PageSizeintegerNo

The number of entries per page. Default value: 10.

10

Response parameters

ParameterTypeDescriptionExample
object
Codestring

The response code.

200
Messagestring

The returned message.

Note If the request was successful, Successful is returned. If the request failed, an error message is returned.
Successful
RequestIdstring

The request ID.

B6D17591-B48B-4D31-9CD6-9B9796B2****
Successstring

Indicates whether the request was successful. Valid values:

  • true
  • false
true
Dataobject

The data returned.

Namestring

The task name.

TaskIdstring

The task ID.

9a4f5c4494dbd6713185d87a97aa53e8
TaskTypestring

The task type. Valid values:

  • Export
  • Query
Query
CreateTimelong

The time when the task was created. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1681363254423
Statusstring

The task state. Valid values:

  • INIT: The task is to be scheduled.
  • RUNNING: The task is running.
  • FAILED: The task failed.
  • CANCELED: The task is canceled.
  • COMPLETED: The task is complete.
Note If a task is in the COMPLETED state, you can view the results of the task.
COMPLETED
Expireboolean

Indicates whether the task has expired. Valid values:

  • true
  • false
false
Startlong

The beginning of the time range to query. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1596177993000
Endlong

The end of the time range to query. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1608888296000
Filtersarray<object>

The filter parameters.

Filterobject
Keystring

The name of the filter parameter.

Note For more information about the filter parameters, see the Valid values of Key section of this topic.
keyWords
Valueany

The value of the filter parameter.

select
Totallong

The total number of tasks.

1
Queriesarray<object>

The results of the offline querying task.

Querieobject
Vipstring

The IP address to which the endpoint used for query is resolved.

10.146.XX.XX
NodeIdstring

The ID of the child node.

pi-bp1o58x3ib7e6****
SqlTextstring

The queried SQL statement.

SELECT @@session.transaction_read_only
SqlTypestring

The type of the SQL statement. Valid values:

  • SELECT
  • UPDATE
  • DELETE
SELECT
Statestring

The execution result of the SQL statement. Valid values:

  • 0: The execution was successful.
  • 1: The execution failed.
0
DBNamestring

The database name.

testdb01
SqlIdstring

The ID of the SQL statement.

a4111670e80596c5bf42cf5154438a91
ExecuteTimestring

The execution time. The time follows the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time is displayed in UTC.

2023-12-07T02:15:32Z
OriginTimelong

The execution timestamp. This value is a UNIX timestamp representing the number of milliseconds that have elapsed since January 1, 1970, 00:00:00 UTC.

1701886532000
AccountNamestring

The database account.

testname
HostAddressstring

The IP address of the client.

11.197.XX.XX
Consumelong

The execution duration. Unit: millisecond.

58
LockTimelong

The lock wait time. Unit: millisecond.

0
UpdateRowslong

The number of rows updated.

0
ScanRowslong

The number of rows scanned.

0
ReturnRowslong

The number of rows returned.

0
LogicReadlong

The number of logical reads.

0
PhysicSyncReadlong

The number of physical synchronous reads.

0
PhysicAsyncReadlong

The number of physical asynchronous reads.

0
ThreadIdlong

The thread ID.

None
TrxIdinteger

The transaction ID.

200000
Extstring

The extended information. This parameter is a reserved parameter.

None
Scntlong

The number of requests from the compute nodes (CNs) to the data nodes (DNs) in the PolarDB-X 2.0 instance.

10
Rowslong

The total number of rows updated or returned by the CNs of the PolarDB-X 2.0 instance.

10
Frowslong

The number of rows pulled by the CNs of the PolarDB-X 2.0 instance.

10
TraceIdstring

The trace ID of the PolarDB-X 2.0 instance, which is the execution ID of the SQL statement on the DN.

14c93b7c7bf00000
UseImciEnginestring

Indicates whether the PolarDB for MySQL instance uses In-Memory Column Indexes (IMCIs). Valid values:

  • true
  • false
true
ParallelDegreestring

The wait time of parallel queries in the queue in the PolarDB for MySQL instance. Unit: millisecond.

10
ParallelQueueTimestring

The degree of parallelism (DOP) value of the PolarDB for MySQL instance.

2
PhysicReadlong

The total number of physical reads.

0
CpuTimelong

The CPU execution time. Unit: microsecond.

100
Writeslong

The number of writes to the ApsaraDB RDS for SQL Server instance.

10
Exportstring

The download URL of the export task.

"https://das-sqllog-download-cn-hongkong.oss-cn-hongkong.aliyuncs.com/****"

Valid values of Key:

  • KeyWords: the keywords. Separate multiple keywords with spaces.
  • LogicalOperator: the logical operator between keywords. Valid values: and and or.
  • AccountName: the database account.
  • DBName: the database name.
  • HostAddress: the IP address of the client.
  • MaxConsume: the maximum execution duration. Unit: millisecond.
  • MinConsume: the minimum execution duration. Unit: millisecond.
  • MaxScanRows: the maximum number of rows scanned.
  • MinScanRows: the minimum number of rows scanned.
  • SqlType: the type of the SQL statement. Valid values: select, update, insert, and delete.
  • State: the execution result. Valid values: 0 and 1. A value of 0 indicates that the execution was successful. A value of 1 indicates that the execution failed.
  • ThreadId: The thread ID.
  • SortKey: the name of the column for sorting. Valid values: ScanRows, UpdateRows, Consume, ExecuteTime, ReturnRows, LockTime, Frows, Scnt, CpuTime, and PhysicalRead.
  • SortMethod: The sorting order. Valid values: DESC and ASC. A value of DESC indicates the descending order. A value of ASC indicates the ascending order. Default value: DESC.
  • TraceId: the trace ID of the PolarDB-X 2.0 instance.
  • MinRows: the minimum number of rows updated.
  • MaxRows: the maximum number of rows updated.
  • MinScnt: the minimum number of requests from the CNs to the DNs in the PolarDB-X 2.0 instance.
  • MaxScnt: the maximum number of requests from the CNs to the DNs in the PolarDB-X 2.0 instance.
  • TrxId: the transaction ID.
  • Fail: the error code.
  • sqlId: the ID of the SQL statement.
  • JobId: the task ID. For a database instance for which DAS Enterprise Edition V0 or V1 is enabled, you must use the asynchronous task ID to query the returned results.

Examples

Sample success responses

JSONformat

{
  "Code": "200",
  "Message": "Successful",
  "RequestId": "B6D17591-B48B-4D31-9CD6-9B9796B2****",
  "Success": "true",
  "Data": {
    "Name": "",
    "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,
        "Ext": "None",
        "Scnt": 10,
        "Rows": 10,
        "Frows": 10,
        "TraceId": "14c93b7c7bf00000 ",
        "UseImciEngine": "true\n",
        "ParallelDegree": "10\n",
        "ParallelQueueTime": "2",
        "PhysicRead": 0,
        "CpuTime": 100,
        "Writes": 10
      }
    ],
    "Export": "\"https://das-sqllog-download-cn-hongkong.oss-cn-hongkong.aliyuncs.com/****\""
  }
}

Error codes

HTTP status codeError codeError message
400InvalidParamsThe request parameters are invalid.
403NoPermissionYou are not authorized to do this action.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-07-03The Error code has changed. The response structure of the API has changedView Change Details
2024-05-22The Error code has changed. The response structure of the API has changedView Change Details