All Products
Search
Document Center

Database Autonomy Service:GetKillInstanceSessionTaskResult

Last Updated:Jun 10, 2026

Mengkueri hasil tugas yang menghentikan tugas sesi.

Deskripsi operasi

  • This operation is applicable only to ApsaraDB RDS for MySQL instances and PolarDB for MySQL clusters.

  • If you use an Alibaba Cloud SDK or a Database Autonomy Service (DAS) SDK to call this operation, we recommend that you use the latest version of the SDK.

  • If you use an SDK to call operations of DAS, you must set the region ID 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:GetKillInstanceSessionTaskResult

get

*全部资源

*

None None

Parameter permintaan

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

ID instans.

rm-2ze1jdv45i7l6****

NodeId

string

No

ID node.

Catatan

Anda harus menentukan parameter ini jika Instansiasi database Anda adalah kluster PolarDB Basis Data Relasional Cloud-Native for MySQL.

pi-8vbkfj5a756um****

TaskId

string

Yes

ID tugas. Anda dapat memperoleh ID tugas dari parameter tanggapan operasi CreateKillInstanceSessionTask.

f77d535b45405bd462b21caa3ee8****

Elemen respons

Element

Type

Description

Example

object

The response parameters.

Code

integer

The HTTP status code returned.

200

Message

string

The returned message.

Catatan

If the request was successful, Successful is returned. If the request failed, an error message such as an error code is returned.

Successful

Data

object

The data returned.

TaskId

string

The task ID.

f77d535b45405bd462b21caa3ee8****

UserId

string

The ID of the Alibaba Cloud account.

164882191396****

InstanceId

string

The instance ID.

rm-2ze1jdv45i7l6****

NodeId

string

The node ID.

Catatan

This parameter is returned only if the instance is a PolarDB for MySQL cluster.

pi-bp1h12rv501cv****

TaskState

string

The state of the task that terminates sessions.

  • RUNNING: The task is in progress.

  • SUCCESS: The task is successful.

  • FAILURE: The task failed.

  • ERROR: Other errors occur.

SUCCESS

Sessions

array

The session IDs.

Catatan

If all sessions are terminated, the IDs of all sessions on the instance or node are returned.

integer

The session ID.

[ 152, 112, 106, 146, 8357323, 5697053, 8357518, 8357519, 14964383 ]

KillSuccessCount

integer

The number of sessions that were terminated.

100

KillFailCount

integer

The number of sessions that failed to be terminated.

0

IgnoredUserSessionCount

integer

The number of ignored sessions, including sessions of the accounts that are specified by IgnoredUsers, sessions of internal O&M accounts of Alibaba Cloud, and Binlog Dump sessions.

9

Result

array<object>

The details of the task that terminated sessions.

object

Id

integer

The session ID.

8357518

User

string

The account of the database.

testUser

Host

string

The IP address and port number of the host that initiated the session.

100.104.XX.XX:23428

Db

string

The name of the database.

dbTest

Command

string

The type of the command executed in the session.

Sleep

Time

integer

The execution duration. Unit: seconds.

1

State

string

The status of the session.

Sending data

Info

string

The SQL statement executed in the session.

SELECT sleep(60)

Active

boolean

Indicates whether the session is active.

Catatan

If the type of the command is Query or Execute and the session in the transaction is not terminated, the session is active.

true

TaskId

string

The ID of the subtask that terminates the session.

task_d9e94107-6116-4ac3-b874-81466aff****

Reason

string

The description of the session when the session was terminated.

  • SESSION_KILLED: The session is terminated.

  • SESSION_EXPIRED: The session has expired.

  • SESSION_NO_PERMISSION: The account used to terminate the session has insufficient permissions.

  • SESSION_ACCOUNT_ERROR: The account or password used to terminate the session is invalid.

  • SESSION_IGNORED_USER: The session of the account does not need to be terminated.

  • SESSION_INTERNAL_USER_OR_COMMAND: The session is a session initiated by or a command run by an Alibaba Cloud O&M account.

  • SESSION_KILL_TASK_TIMEOUT: Timeout occurs when the session is terminated.

  • SESSION_OTHER_ERROR: Other errors occurred.

SESSION_KILLED

RequestId

string

The request ID.

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

Success

boolean

Indicates whether the request was successful. Valid values:

  • true

  • false

true

Contoh

Respons sukses

JSONformat

{
  "Code": 200,
  "Message": "Successful",
  "Data": {
    "TaskId": "f77d535b45405bd462b21caa3ee8****",
    "UserId": "164882191396****",
    "InstanceId": "rm-2ze1jdv45i7l6****",
    "NodeId": "pi-bp1h12rv501cv****",
    "TaskState": "SUCCESS",
    "Sessions": [
      0
    ],
    "KillSuccessCount": 100,
    "KillFailCount": 0,
    "IgnoredUserSessionCount": 9,
    "Result": [
      {
        "Id": 8357518,
        "User": "testUser",
        "Host": "100.104.XX.XX:23428",
        "Db": "dbTest",
        "Command": "Sleep",
        "Time": 1,
        "State": "Sending data",
        "Info": "SELECT sleep(60)",
        "Active": true,
        "TaskId": "task_d9e94107-6116-4ac3-b874-81466aff****",
        "Reason": "SESSION_KILLED"
      }
    ]
  },
  "RequestId": "B6D17591-B48B-4D31-9CD6-9B9796B2****",
  "Success": true
}

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.