Note
This variable is available starting with V1.4.
Description
tx_read_only specifies whether to set a transaction to read-only mode.
Privilege requirements
Query variables
Global level
systenants and all user tenants can execute theSHOW VARIABLESstatement or query theSYS.TENANT_VIRTUAL_GLOBAL_VARIABLEview (Oracle mode) orinformation_schema.GLOBAL_VARIABLESview (MySQL mode) to view the values of global system variables.Session level
systenants and all user tenants can execute theSHOW VARIABLESstatement or query theSYS.TENANT_VIRTUAL_SESSION_VARIABLEview (Oracle mode) orinformation_schema.SESSION_VARIABLESview (MySQL mode) to view the values of session system variables.
Modify variables
Global level
systenants can modify the values of global system variables.MySQL user tenants must have the
SUPERorALTER SYSTEMprivilege to modify the values of global system variables.Oracle user tenants must have the
ALTER SYSTEMprivilege to modify the values of global system variables.
Session level
systenants and all user tenants can modify the values of session system variables.
Attributes
| Attribute | Description |
|---|---|
| Type | Int |
| Default value | 0 |
| Value range |
|
| Scope |
|
| Modifiable | Yes. You can execute the SET statement to modify the value. |
Usage notes
After you set the tx_read_only system variable:
If the variable is set at the session level, it only affects the current user and does not affect other users.
If the variable is set at the global level, it affects all users who connect to the database in the future.
Examples
Set a transaction to read-only mode.
Session level
obclient> SET tx_read_only = 1;Global level
obclient> SET GLOBAL tx_read_only = 1;