[TOC] # SESSION ## 描述 该语句用来强制结束 session。 ## 格式 ~~~ session_stmt: KILL [CONNECTION] session_id; session_id: INT_VALUE ~~~ ## 参数解释 <table data-tag="table" id="table-g5y-bpm-9h6" class="table"><colgroup width="360" span="1" data-tag="col" id="col-k7w-zuy-zpk" colwidth="1*" colnum="1" colname="col1" style="width:50%" class="col"></colgroup><colgroup width="360" span="1" data-tag="col" id="col-ypx-aho-cn3" colwidth="1*" colnum="2" colname="col2" style="width:50%" class="col"></colgroup><thead id="thead-spv-ppy-e5p" class="thead"><tr id="tr-a25-eae-7bk"><th id="td-1jo-cg6-2mf"><p id="p-3h0-v3u-t59"><b>参数</b></p></th><th id="td-d1r-1gx-vlr"><p id="p-8d2-tbb-xsq"><b>描述</b></p></th></tr></thead><tbody data-tag="tbody" id="tbody-zx4-299-akp" class="tbody"><tr data-tag="tr" id="tr-v49-syo-z3l" class="tr"><td data-tag="td" id="td-uf5-ch6-lzm" class="td"><p data-tag="p" id="p-60w-vl2-s76" class="p">session_id</p></td><td data-tag="td" id="td-g9b-3dg-bgh" class="td"><p data-tag="p" id="p-z7m-scm-juk" class="p">要结束 session 的编号</p></td></tr></tbody></table> ## 示例 * 强制结束编号为 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) ~~~