All Products
Search
Document Center

SESSION

Last Updated: Jun 18, 2021

Description

You can execute the SESSION statement to close a session.

Syntax

session_stmt:
    KILL [CONNECTION] session_id;

session_id:
    INT_VALUE

Parameters

Parameter

Description

session_id

The ID of the session that you want to close.

Examples

  • Close sessions 3221502221 and 3221750376.
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)