In the left-side navigation pane, click Tenants. On the Tenants page, click the name of the tenant in the Tenants list to go to the Overview page of the tenant. In the left-side navigation pane, click Session Management. The Session Management page automatically appears, and the Tenant Session tab is displayed. The Session Management page contains three tabs: Tenant Session, Session Statistics, and View Deadlock History. This topic describes the information on the Session Management page and the operations that you can perform on this page.
Note
obshell supports session management starting from V4.4.0. To obtain the installation package, visit the Alibaba Cloud mirror site. For information about how to upgrade obshell, see Manage clusters.
Manage tenant sessions
The Tenant Session tab displays all the current sessions of the tenant, including the session ID, SQL statement, SQL ID, user, source, database name, command, execution time (s), status, OBServer, and OBProxy. You can search for sessions by session ID, user, source, or database name.
View SQL information.
When the session status is ACTIVE, click the value in the SQL column to view the SQL details of the session in a dialog box. You can click Copy to copy the SQL information.
Search for sessions.
You can search for sessions by user, source, or database name. Click the magnifying glass icon on the right side of the column name to open a search input box. Enter the user, source, or database name, and click Search to view only the sessions that match the search criteria.
Note
You can also search for sessions by session ID in the upper-right corner of the Session Management tab.
View only active sessions.
After you enable View Only Active Sessions in the upper-right corner of the session list, only the sessions with the ACTIVE status are displayed.
Terminate a session.
In the operation column of the session list, click Close Session. In the dialog box that appears, click OK to terminate the current session. If you select one or more sessions, the Close Session button appears in the lower-right corner of the Session Management tab. Click Close Session and click OK in the dialog box that appears to terminate the selected sessions.
Terminate the current query.
In the operation column of the session list, select ··· > Close Current Query. In the dialog box that appears, click OK to terminate the current query. If you select one or more sessions, the Close Current Query button appears in the lower-right corner of the Session Management tab. Click Close Current Query and click OK in the dialog box that appears to terminate the current queries of the selected sessions.
Note
Terminating a session terminates the session with the specified Client Session ID. Terminating the current query terminates the statement that is currently being executed, but keeps the session connection unchanged.
View session statistics
Click Session Management in the upper-right corner of the page, and then click Session Statistics in the left-side navigation pane. The session statistics are displayed.
The statistics include overall session details such as Total Sessions, Active Sessions, and Maximum Session Duration (s). The Session Statistics tab also displays the Active Sessions and Total Sessions for each User, Source, and Database.
You can count the number of active sessions and total sessions for an object based on users, sources, or databases. For example, in the User column of the list, click the magnifier to display the search field. Type a username and click Search to view only the session counts for that user.
Support ascending and descending order for the number of active sessions and total number of sessions in each statistic. You can click the sort icon on the right of the Active Number and Total columns in the session statistics list to sort the sessions by ascending or descending order.
Click the User > Source > Database in the Total field to go to the session details page of the corresponding user, source, or database, where all session details are displayed. For more information, see Manage sessions of a tenant.
View deadlock history information
On the Session Management page, click View Deadlock History in the upper-right corner to go to the Deadlock History tab and view information about the deadlock history.
Description
Deadlock detection is enabled by default at the cluster level and is a cluster-wide feature. To disable it, go to the Clusters page, click ··· in the upper-right corner, select Disable Automatic Deadlock Detection from the drop-down menu, and confirm the action in the modal dialog. After it's disabled, you can enable it again by following the same steps.
