All Products
Search
Document Center

Database Autonomy Service:DescribeSqlLogTask

Last Updated:Jun 10, 2026

Memanggil operasi `DescribeSqlLogTask` untuk mengkueri detail tugas offline di DAS Edisi Perusahaan.

Deskripsi operasi

Note the following before you call this operation:

  • We recommend using the latest version of the Alibaba Cloud SDK or DAS SDK.

  • When calling the DAS service with an SDK, set the region to cn-shanghai.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tabel berikut menjelaskan otorisasi yang diperlukan untuk memanggil API ini. Anda dapat menentukannya dalam kebijakan Resource Access Management (RAM). Kolom pada tabel dijelaskan sebagai berikut:

  • Action: Aksi yang dapat digunakan dalam elemen Action pada pernyataan kebijakan izin RAM untuk memberikan izin guna melakukan operasi tersebut.

  • API: API yang dapat Anda panggil untuk melakukan aksi tersebut.

  • Access level: Tingkat akses yang telah ditentukan untuk setiap API. Nilai yang valid: create, list, get, update, dan delete.

  • Resource type: Jenis resource yang mendukung otorisasi untuk melakukan aksi tersebut. Ini menunjukkan apakah aksi tersebut mendukung izin tingkat resource. Resource yang ditentukan harus kompatibel dengan aksi tersebut. Jika tidak, kebijakan tersebut tidak akan berlaku.

    • Untuk API dengan izin tingkat resource, jenis resource yang diperlukan ditandai dengan tanda bintang (*). Tentukan Nama Sumber Daya Alibaba Cloud (ARN) yang sesuai dalam elemen Resource pada kebijakan.

    • Untuk API tanpa izin tingkat resource, ditampilkan sebagai All Resources. Gunakan tanda bintang (*) dalam elemen Resource pada kebijakan.

  • Condition key: Kunci kondisi yang didefinisikan oleh layanan. Kunci ini memungkinkan kontrol granular, berlaku baik hanya untuk aksi maupun untuk aksi yang terkait dengan resource tertentu. Selain kunci kondisi spesifik layanan, Alibaba Cloud menyediakan serangkaian common condition keys yang berlaku di semua layanan yang didukung RAM.

  • Dependent action: Aksi dependen yang diperlukan untuk menjalankan aksi tersebut. Untuk menyelesaikan aksi tersebut, pengguna RAM atau role RAM harus memiliki izin untuk melakukan semua aksi dependen.

Action

Access level

Resource type

Condition key

Dependent action

hdm:DescribeSqlLogTask

get

*全部资源

*

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

InstanceId

string

No

ID Instansiasi basis data.

r-bp1nti25tc7bq5****

TaskId

string

No

ID Tugas.

a4f5c4494dbd6713185d87a97aa53e8

PageNo

integer

No

Nomor halaman. Halaman diberi nomor mulai dari 1. Nilai default: 1.

1

PageSize

integer

No

Ukuran halaman. Nilai maksimum: 100. Nilai default: 10.

10

Elemen respons

Element

Type

Description

Example

object

The root node of the response.

Code

string

The returned HTTP status code.

200

Message

string

The response message.

Catatan

If the request is successful, Successful is returned. Otherwise, an error message is returned.

Successful

RequestId

string

The request ID.

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

Success

string

Indicates whether the request was successful. Valid values:

  • true: The request was successful.

  • false: The request failed.

true

Data

object

The returned data.

Name

string

The task name.

SQL审计导出1

TaskId

string

The task ID.

9a4f5c4494dbd6713185d87a97aa53e8

TaskType

string

The task type. Valid values:

  • Export: an export task.

  • Query: a query task.

Query

CreateTime

integer

The time when the task was created, which is a UNIX timestamp in milliseconds.

1681363254423

Status

string

The task status. Valid values:

  • INIT: The task is pending.

  • RUNNING: The task is running.

  • FAILED: The task failed.

  • CANCELED: The task was canceled.

  • COMPLETED: The task is complete.

Catatan

The results of an offline task are available only when the status is COMPLETED.

COMPLETED

Expire

boolean

Indicates whether the task has expired. Valid values:

  • true: The task has expired.

  • false: The task has not expired.

false

Start

integer

The beginning of the query time range, which is a UNIX timestamp in milliseconds.

1596177993000

End

integer

The end of the query time range, which is a UNIX timestamp in milliseconds.

1608888296000

Filters

array<object>

The filter conditions.

object

A query filter condition.

Key

string

The name of the filter parameter.

Catatan

For more information about the supported filter parameters and their valid values, see the "Additional information about response parameters" section.

keyWords

Value

any

The value of the filter parameter.

select

Total

integer

The total number of tasks.

1

Queries

array<object>

The results of the offline query task. This parameter is returned only if the value of TaskType is Query.

object

The result of the offline query task.

Vip

string

The endpoint address that the query link resolves to.

10.146.XX.XX

NodeId

string

The node ID.

pi-bp1o58x3ib7e6****

SqlText

string

The details of the SQL statement.

SELECT @@session.transaction_read_only

SqlType

string

The type of the SQL statement. Valid values:

  • SELECT

  • UPDATE

  • DELETE

SELECT

State

string

The execution result.

  • 0: The execution was successful.

  • 1: The execution failed.

0

DBName

string

The database name.

testdb01

SqlId

string

The SQL ID.

a4111670e80596c5bf42cf5154438a91

ExecuteTime

string

The time when the SQL statement was executed. The time is in the yyyy-MM-ddTHH:mm:ssZ format and in UTC.

2023-12-07T02:15:32Z

OriginTime

integer

The time when the SQL statement was executed. This is a UNIX timestamp. Unit: ms.

1701886532000

AccountName

string

The database account.

testname

HostAddress

string

The client IP address.

11.197.XX.XX

Consume

integer

The execution duration. Unit: ms.

58

LockTime

integer

The lock wait time. Unit: ms.

0

UpdateRows

integer

The number of updated rows.

0

ScanRows

integer

The number of scanned rows.

0

ReturnRows

integer

The number of returned rows.

0

LogicRead

integer

The number of logical reads.

0

PhysicSyncRead

integer

The number of physical synchronous reads.

0

PhysicAsyncRead

integer

Physical (asynchronous) read.

0

ThreadId

integer

The thread ID.

None

TrxId

string

The transaction ID.

200000

Ext

string

Reserved for future use.

None

Scnt

integer

The number of requests sent from compute nodes to data nodes of a PolarDB-X 2.0 instance.

10

Rows

integer

The total number of rows updated or returned by the compute nodes of a PolarDB-X 2.0 database instance.

10

Frows

integer

The number of rows fetched by the compute nodes of a PolarDB-X 2.0 instance.

10

TraceId

string

The trace ID of a PolarDB-X 2.0 instance. This is the ID of the SQL statement that is executed on a data node.

14c93b7c7bf00000

UseImciEngine

string

Indicates whether an In-Memory Column Index (IMCI) is used for the PolarDB for MySQL instance.

  • true

  • false

true

ParallelDegree

string

The parallel queuing time for a PolarDB MySQL instance, in milliseconds.

10

ParallelQueueTime

string

The degree of parallelism of the PolarDB for MySQL instance.

2

PhysicRead

integer

The number of physical reads.

0

CpuTime

integer

The CPU execution time. Unit: μs.

100

Writes

integer

The number of writes for the ApsaraDB RDS for SQL Server engine.

10

Collection

string

Reserved.

None

SqlCommand

integer

The SQL command in the query.

sql

ConnectionId

string

ld-******

Protected

string

MySQL

Params

string

[1, "das"]

ClientIp

string

10.0.0.1xx

ClientPort

integer

3306

RowKey

string

23

AffectColumns

string

["col1"]

TableName

string

das

Export

string

The download URL of the exported file. This parameter is returned only if the value of TaskType is Export.

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

Parameter Key mendukung kunci berikut:

  • KeyWords: Kata kunci. Pisahkan beberapa kata kunci dengan spasi.

  • LogicalOperator: Operator logika untuk menggabungkan kata kunci. Nilai valid: and atau or.

  • AccountName: Nama pengguna. Anda dapat menentukan hingga lima nama pengguna, dipisahkan dengan koma (,).

  • dbName: Nama database. Anda dapat menentukan hingga lima nama database, dipisahkan dengan koma (,).

  • HostAddress: Alamat IP Klien. Anda dapat menentukan hingga lima alamat IP klien, dipisahkan dengan koma (,).

  • MaxConsume: Durasi eksekusi maksimum, dalam mikrodetik (μs).

  • MinConsume: Durasi eksekusi minimum, dalam mikrodetik (μs).

  • MaxScanRows: Jumlah maksimum baris yang dipindai.

  • MinScanRows: Jumlah minimum baris yang dipindai.

  • SqlType: Tipe SQL. Nilai valid: select, update, insert, dan delete.

  • State: Hasil eksekusi. Nilai valid: 0 (berhasil) atau 1 (gagal).

  • ThreadId: ID thread.

  • SortKey: Kunci pengurutan. Nilai valid: ScanRows (jumlah baris yang dipindai), UpdateRows (jumlah baris yang diperbarui), Consume (durasi eksekusi), ExecuteTime (pengatur waktu eksekusi), ReturnRows (jumlah baris yang dikembalikan), LockTime (pengatur waktu tunggu kunci), Frows (jumlah baris yang diambil oleh node komputasi instans PolarDB Basis Data Relasional Cloud-Native-X 2.0), Scnt (jumlah permintaan yang dikirim dari node komputasi ke node data instans PolarDB Basis Data Relasional Cloud-Native-X 2.0), CpuTime (pengatur waktu eksekusi CPU), dan PhysicalRead (jumlah pembacaan fisik).

  • SortMethod: Urutan pengurutan. Nilai valid: DESC (menurun) dan ASC (menaik). Nilai default adalah DESC.

  • TraceId: ID jejak instans PolarDB Basis Data Relasional Cloud-Native-X 2.0.

  • MinRows: Jumlah minimum baris yang diperbarui.

  • MaxRows: Jumlah maksimum baris yang diperbarui.

  • MinScnt: Jumlah minimum permintaan yang dikirim dari node komputasi (CN) ke node data (DN) untuk instans PolarDB Basis Data Relasional Cloud-Native-X 2.0.

  • MaxScnt: Jumlah maksimum permintaan yang dikirim dari node komputasi (CN) ke node data (DN) untuk instans PolarDB Basis Data Relasional Cloud-Native-X 2.0.

  • TrxId: ID transaksi.

  • Fail: Kode error.

  • SqlId: ID SQL.

Contoh

Respons sukses

JSONformat

{
  "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,
        "ConnectionId": "ld-******",
        "Protected": "MySQL",
        "Params": "[1, \"das\"]",
        "ClientIp": "10.0.0.1xx",
        "ClientPort": 3306,
        "RowKey": "23",
        "AffectColumns": "[\"col1\"]",
        "TableName": "das"
      }
    ],
    "Export": "\"https://das-sqllog-download-cn-hongkong.oss-cn-hongkong.aliyuncs.com/****\""
  }
}

Kode kesalahan

HTTP status code

Error code

Error message

Description

400 InvalidParams The request parameters are invalid.
403 NoPermission You are not authorized to do this action.

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.