Description
Terminates sessions held in the session connection pool.
Privilege requirements
Only root@sys and root@proxysys may run this statement. root@sys can terminate sessions for all tenants in the current cluster. root@proxysys (ODP super user) can terminate sessions across all clusters and tenants.
Syntax
KILL GLOBALSESSION 'dbkey' [ss_id]
Parameters
Parameter |
Description |
|---|---|
| 'dbkey' | Target tenant in the form cluster_name:tenant_name. If only dbkey is given, all pooled sessions for that tenant are terminated. Use SHOW GLOBALSESSION to list sessions; see SHOW GLOBALSESSION. |
| ss_id | Session identifier used by ODP. Obtain it from SHOW GLOBALSESSION. When specified, only that session is terminated. |
Examples
Connect through ODP as
root@sys:obclient -h10.10.10.1 -uroot@sys#obdemo -P2883 -p -c -AAdjust host, user, and port as needed. For connection steps, see Connect to an OceanBase Database tenant by using OBClient.
List pooled sessions for tenant
test:SHOW GLOBALSESSION ATTRIBUTE 'obcluster:test'\GExample output with two sessions (
ss_id193and43):*************************** 1. row *************************** dbkey_name: obcluster:test auth_user: admin@test#obcluster server_ip: 10.10.10.1:25706 local_ip: 10.10.10.2:35950 session_state: KEEP_ALIVE_GLOBAL_SHARED server_session_id: 3222004961 ss_id: 193 create_time: 2025-04-08 16:55:26.458191 last_release_time: 2025-04-08 16:55:38.803114 timeout_time: 2025-04-08 17:25:38.803114 *************************** 2. row *************************** dbkey_name: obcluster:test auth_user: admin@test#obcluster server_ip: 10.10.10.1:25704 local_ip: 10.10.10.2:33250 session_state: KEEP_ALIVE_GLOBAL_SHARED server_session_id: 3221679414 ss_id: 43 create_time: 2025-04-08 16:41:00.410908 last_release_time: 2025-04-08 16:55:38.803067 timeout_time: 2025-04-08 17:25:38.803067Terminate one session:
KILL GLOBALSESSION 'obcluster:test' 193;Verify:
SHOW GLOBALSESSION ATTRIBUTE 'obcluster:test'\GOnly
ss_id43should remain:*************************** 1. row *************************** dbkey_name: obcluster:test auth_user: admin@test#obcluster server_ip: 10.10.10.1:25704 local_ip: 10.10.10.2:33250 session_state: KEEP_ALIVE_GLOBAL_SHARED server_session_id: 3221679414 ss_id: 43 create_time: 2025-04-08 16:41:00.410908 last_release_time: 2025-04-08 16:55:38.803067 timeout_time: 2025-04-08 17:25:38.803067
