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.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 privileges, contact the administrator to obtain the privileges. For more information, see Modify user privileges.
For more information about how to view your privileges in MySQL mode, see View user privileges. If you do not have the required privileges, contact the administrator to obtain the privileges. For more information, see Modify user 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 in SQL Reference (MySQL Mode), or KILL in SQL Reference (Oracle Mode).