Description
This statement terminates a session. Note
If you have the PROCESS permission, you can view all the sessions. If you have the SUPER permission, you can terminate all the sessions and statements. Otherwise, you can view and terminate only your own sessions and statements.
Syntax
KILL [CONNECTION | QUERY] 'sessionid'
Parameter description
| Parameter | Description |
|---|---|
| KILL | Terminates the specified threadid. This parameter is the same as KILL CONNECTION. |
| KILL CONNECTION | Terminates the specified threadid. This parameter is the same as the KILL statement that does not contain a modifier. |
| KILL QUERY | Terminates the statement that is being executed over the connection. The connection remains unchanged. |
Examples
- Terminate the connection from the session whose sessionid is 3221638213 to the statement that is being executed, and then terminate the session.
OceanBase(admin@test)>show processlist;
+------------+-------+--------------------+------+---------+------+--------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+------------+-------+--------------------+------+---------+------+--------+------------------+
| 3221638212 | admin | 1.11.111.127:11161 | test | Query | 0 | ACTIVE | show processlist |
| 3221638213 | admin | 1.11.111.127:11161 | test | Query | 0 | ACTIVE | select "abcedfg" |
+------------+-------+--------------------+------+---------+------+--------+------------------+
1 row in set (0.03 sec)
OceanBase(admin@test)>kill query 3221638213;
Query OK, 0 rows affected (0.01 sec)
OceanBase(admin@test)>kill 3221638212;
Query OK, 0 rows affected (0.01 sec)