All Products
Search
Document Center

Database Autonomy Service:GetKillInstanceSessionTaskResult

Last Updated:Mar 13, 2026

Queries the results of a task that terminates sessions.

Operation description

  • 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.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

hdm:GetKillInstanceSessionTaskResult

get

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The instance ID.

rm-2ze1jdv45i7l6****

NodeId

string

No

The node ID.

Note

You must specify this parameter if your database instance is a PolarDB for MySQL cluster.

pi-8vbkfj5a756um****

TaskId

string

Yes

The task ID. You can obtain the task ID from the response parameters of the CreateKillInstanceSessionTask operation.

f77d535b45405bd462b21caa3ee8****

Response elements

Element

Type

Description

Example

object

Code

integer

The HTTP status code returned.

200

Message

string

The returned message.

Note

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.

Note

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.

Note

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.

Note

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

Examples

Success response

JSON format

{
  "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
}

Error codes

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.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.