OceanBase Database supports the KILL statement to terminate a session.
The SQL statement to terminate a session is as follows:
KILL [CONNECTION] 'session_id';
The statement is used as follows:
The
KILLstatement can only terminate one session at a time.In MySQL mode, a normal user can view all sessions if it has the
PROCESSprivilege. If it has theSUPERprivilege, it can terminate all sessions and statements. Otherwise, a normal user can only view and terminate its own sessions and statements. A tenant administrator can terminate all sessions and statements.For more information about how to view privileges in MySQL mode, see View user privileges. If you do not have the required privileges, contact your administrator to add them. For more information about how to grant privileges to a user, see Grant privileges directly.
In Oracle mode, a normal user can only view and terminate its own sessions and statements. If it has the
SHOW PROCESSprivilege, it can view all sessions. A tenant administrator can terminate all sessions and statements.For more information about how to view privileges in Oracle mode, see View user privileges. If you do not have the required privileges, contact your administrator to add them. For more information about how to grant privileges to a user, see Grant privileges directly.
Here is an example of terminating a specified session:
KILL session_id;
or
KILL CONNECTION session_id;
In the preceding statements, session_id is the session ID, which can be obtained by executing 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) and KILL (Oracle mode).
