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 parameters in the syntax are described as follows:
You can execute the
KILLstatement to terminate only one session at a time.If you have the
PROCESSprivilege, you can view all sessions. If you have theSUPERprivilege, you can terminate all sessions and statements one by one. Otherwise, you can view and terminate only the sessions and statements that you have initiated. An administrator can terminate all sessions and statements one by one.Note
For more information about how to view your privileges in Oracle mode, see View user privileges. If you do not have the required privilege, contact the administrator to obtain the privilege. For more information about how to grant privileges to a user, see Grant direct privileges.
For information about how to view your privileges in MySQL mode, see View user privileges. If you do not have the required privilege, contact the administrator to obtain the privilege. For more information about how to grant privileges to a user, see Grant direct privileges.
Here is a sample statement for terminating a specified session:
KILL session_id;
or
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 (MySQL Mode), or KILL (Oracle Mode).