All Products
Search
Document Center

:Session management

更新時間:Jan 03, 2023

A session is a connection between an application and a database. On the Session Management page of OceanBase Developer Center (ODC), you can view the details of all the sessions connected to the current database. The Session Properties page of ODC provides a graphical interface where you can view and modify the session variables and global variables that the current database supports.

After you enter a database connection in ODC, click Session in the top navigation bar and then choose Session properties or Session management to go to the corresponding page.

Image 186

Session properties

Session management 2

The session properties are database variables. OceanBase Database provides two types of variables: session variables and global variables.

  • Session variables: When a client connects to a database, the database copies the global variables to automatically generate session variables. The modification of session variables takes effect on the current session only.
  • Global variables: Global variables are shared by all the instances of a database. These variables are shared among different users. When you modify a global variable, the database saves the modification, which remains valid after you disconnect from and reconnects to the database.
Note

  • The current ODC version does not allow you to edit global variables. You can modify session variables.

  • In ODC, multiple identical connections share one single session. In ODC V2.3.2 and later versions, auto-commit is turned off by default in Oracle mode, so you need to manually commit transactions. You can modify the value of the autocommit parameter to change this setting.

  • In manual-commit mode, make sure to set ob_trx_idle_timeout to a value greater than the timeout duration of SQL queries. Otherwise, if two SQL statements in one transaction are executed at an interval longer than the value of ob_trx_idle_timeout, the connection will be terminated. However, if ob_trx_idle_timeout is set to an excessively large value, the session cannot be released in time, resulting in unnecessary memory consumption. Therefore, you need to set this parameter to a proper value.

ODC provides a graphical interface where you can view and modify the variables that the current database supports. Take note of the following items related to the modification of variables:

  • In the current ODC version, session variables have two modes: display mode and edit mode. To modify a variable, select the variable and click Edit in the toolbar to go to the editing page. After you edit a variable, click OK. On the SQL Confirmation page, click Execute to apply the modification.

  • To modify a variable of a character or numeric type, you can directly enter the new value on the Edit page.

  • To modify a variable of an enumeration type, ODC lists the values that the variable supports in the edit box. This allows you to modify the variable in a graphical interface without having to memorize its name or value, which saves your memorization efforts and increases the efficiency of variable modification.

Session management

A session is a connection between an application and a database. On the Session Management page, you can view all the sessions connected to the current database and the following session information:

Information

Description

Session ID

The ID that uniquely identifies the current session.

User

The username used to log on to the database in the current session.

Source

The address from which the session is initiated.

Database name

The name of the database accessed in the session.

Status

The state of the session. Valid values: SLEEP and ACTIVE.

Command

The type of the command being executed in the session.

Execution Time (s)

The time in seconds spent on executing the current SQL query.

SQL

The actual SQL query being executed in the session.

OBProxy

The address of the proxy used for the session.

Manage sessions

The Session Management page provides the following buttons in the navigation bar for you to manage sessions.

  • Refresh: Click this button to refresh the session list.
  • Close Session: Click this button to terminate the current session.
  • Close current query processes of the session: Click this button to terminate the ongoing SQL execution processes in the session.
Note

On the Session Management page, when you hover the mouse over the SQL column in the list, all the SQL statements will be displayed.