全部产品

SESSION

描述

该语句用来强制结束 session。

格式

session_stmt:
    KILL [CONNECTION] session_id;

session_id:
    INT_VALUE

参数解释

参数

描述

session_id

要结束 session 的编号

示例

  • 强制结束编号为 3221502221和 3221750376 的 session。
OceanBase(admin@test)>show processlist;
+------------+-------+---------------------+------+---------+------+--------+----------------------------------+
| Id         | User  | Host                | db   | Command | Time | State  | Info                             |
+------------+-------+---------------------+------+---------+------+--------+----------------------------------+
| 3221502221 | admin | 100.xx.xx.xx:44775  | test | Sleep   |   10 | SLEEP  | NULL                             |
| 3221502083 | admin | 100.xx.xx.xx:44720  | test | Query   |    0 | ACTIVE | show processlist                 |
| 3221502317 | NULL  | 100.xx.xx.xx:41414  | test | Query   |    0 | ACTIVE | REMOTE/DISTRIBUTE PLAN EXECUTING |
| 3221750377 | NULL  | 100.xx.xx.xx:41414  | test | Query   |    0 | ACTIVE | REMOTE/DISTRIBUTE PLAN EXECUTING |
| 3221750376 | admin | 100.xx.xx.xx:43783  | test | Sleep   |    4 | SLEEP  | NULL                             |
+------------+-------+---------------------+------+---------+------+--------+----------------------------------+
5 rows in set (0.04 sec)

OceanBase(admin@test)>kill 3221502221;
Query OK, 0 rows affected (0.00 sec)

OceanBase(admin@test)>kill connection 3221750376;
Query OK, 0 rows affected (0.05 sec)