OceanBase Database allows you to terminate tenant sessions by using the KILL statement.
The syntax of the SQL statement is as follows:
KILL [CONNECTION] 'session_id';
The rules for using the statement are as follows:
You can execute the
KILLstatement to terminate only one session at a time.In MySQL-compatible mode, a normal user can view all sessions if they have the
PROCESSprivilege. If they have theSUPERprivilege, they can terminate all sessions and statements one by one. Otherwise, they can only view and terminate their own sessions and statements. A tenant administrator can terminate all sessions and statements one by one.For information about how to view your privileges in MySQL-compatible mode, see View user privileges. If you do not have the required privileges, contact the administrator to obtain the privileges. For more information, see Grant direct privileges.
In Oracle-compatible mode, a normal user can only view and terminate their own sessions and statements. If they have the
SHOW PROCESSprivilege, they can view all sessions. A tenant administrator can terminate all sessions and statements one by one.For information about how to view your privileges in Oracle-compatible mode, see View user privileges. If you do not have the required privileges, contact the administrator to obtain the privileges. For more information, see Grant direct privileges.
The syntax for terminating a specified session is as follows:
KILL session_id;
Alternatively, use the following syntax:
KILL CONNECTION session_id;
You need to replace session_id with the corresponding session ID, which can be obtained by using the SHOW PROCESSLIST or SHOW FULL PROCESSLIST statement. For more information about how to obtain the session ID, see View tenant sessions.
For more information about the KILL statement, see KILL in SQL Reference (MySQL Mode), or KILL in SQL Reference (Oracle Mode).
