Updated on 2025-11-24 GMT+08:00

Auto Kill Sessions

You can kill all sessions, kill specific sessions by criteria, and view history.

To kill the current session or manually kill a session, see Real-Time Sessions.

Functions

Function

Description

Killing Specific Sessions by Criteria

You can add a task for killing sessions. Sessions that meet the criteria will be killed.

Killing All Sessions

After you enable Auto Kill Sessions and click Kill All Sessions, all sessions are automatically deleted.

Viewing history

You can view killed sessions.

Killing Specific Sessions by Criteria

  1. Log in to the console.
  2. Click in the upper left corner and select a region and project.
  3. Click in the upper left corner, and under Databases, click Data Admin Service.
  4. In the navigation pane, choose Intelligent O&M > Instance List.

    Alternatively, on the Overview page, click Go to Intelligent O&M.

  5. In the upper right corner of the Instance List page, search for instances by engine type, instance name, or instance IP.
  6. Locate the target instance and click Details. The Dashboard page is displayed.
  7. On the SQL tab, click Sessions Auto Killed.
  8. Click on the right of Auto Kill Sessions. In the displayed dialog box, click OK.
  9. Click Add Kill Task.

    Figure 1 Adding a task for killing sessions

  10. In the displayed dialog box, set the criteria for killing sessions. The parameters listed in Table 1 are in a logical AND relationship.

    If you only specify Session Duration (s) and Task Duration (s), all sessions that meet the criteria will be killed.

    A maximum of five conditional kill tasks can be executed at the same time.

    Figure 2 Setting the criteria for killing sessions
    Table 1 Parameter description

    Parameter

    Description

    User

    Enter a single value, for example, root.

    Host IP Address

    Enter a single value, for example, 168.192.0.0.

    Database Name

    Enter a database name.

    Command

    Enter a command.

    SQL Statement

    Enter an SQL statement.

    Session Duration (s)

    The value ranges from 1 to 2147483647.

    Task Closure Method

    If you select Scheduled, you need to set Task Duration. After the duration ends, the task is automatically closed.

    If you select Manual, you can click Stop in the Operation column of the task list to manually close a task.

    Task Duration (s)

    The value ranges from 10 to 31535999.

  11. Click OK.

    When the criteria for killing sessions are met, the system automatically kills the sessions.

Killing All Sessions

  1. Log in to the console.
  2. Click in the upper left corner and select a region and project.
  3. Click in the upper left corner, and under Databases, click Data Admin Service.
  4. In the navigation pane, choose Intelligent O&M > Instance List.

    Alternatively, on the Overview page, click Go to Intelligent O&M.

  5. In the upper right corner of the Instance List page, search for instances by engine type, instance name, or instance IP.
  6. Locate the target instance and click Details. The Dashboard page is displayed.
  7. On the SQL tab, click Sessions Auto Killed.
  8. Click on the right of Auto Kill Sessions. In the displayed dialog box, click OK.
  9. Click Kill All Sessions.

    Figure 3 Killing All Sessions

  10. In the displayed dialog box, click OK.

Viewing killed sessions

  1. Log in to the console.
  2. Click in the upper left corner and select a region and project.
  3. Click in the upper left corner, and under Databases, click Data Admin Service.
  4. In the navigation pane, choose Intelligent O&M > Instance List.

    Alternatively, on the Overview page, click Go to Intelligent O&M.

  5. In the upper right corner of the Instance List page, search for instances by engine type, instance name, or instance IP.
  6. Locate the target instance and click Details. The Dashboard page is displayed.
  7. On the SQL tab, click Sessions Auto Killed.
  8. Click on the right of Auto Kill Sessions. In the displayed dialog box, click OK.
  9. Click View History.

    Figure 4 Killed sessions

  10. In the displayed dialog box, select a time range to view killed sessions within that period.

    A maximum of 500 session records can be displayed.