Note
This view is available starting with V4.2.0.
Purpose
The oceanbase.DBA_OB_TENANT_EVENT_HISTORY view displays the historical operation records of the current tenant.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| TIMESTAMP | timestamp(6) | NO | The execution time, in microseconds. |
| MODULE | varchar(256) | NO | The module name. |
| EVENT | varchar(256) | NO | The event name. |
| NAME1 | varchar(256) | YES | The name of the first attribute. |
| VALUE1 | longtext | YES | The value of the first attribute. |
| NAME2 | varchar(256) | YES | The name of the second attribute. |
| VALUE2 | longtext | YES | The value of the second attribute. |
| NAME3 | varchar(256) | YES | The name of the third attribute. |
| VALUE3 | longtext | YES | The value of the third attribute. |
| NAME4 | varchar(256) | YES | The name of the fourth attribute. |
| VALUE4 | longtext | YES | The value of the fourth attribute. |
| NAME5 | varchar(256) | YES | The name of the fifth attribute. |
| VALUE5 | longtext | YES | The value of the fifth attribute. |
| NAME6 | varchar(256) | YES | The name of the sixth attribute. |
| VALUE6 | longtext | YES | The value of the sixth attribute. |
| EXTRA_INFO | longtext | YES | Additional information. |
| SVR_IP | varchar(46) | YES | The IP address of the OBServer node where the action was executed. |
| SVR_PORT | bigint(20) | YES | The port number of the OBServer node where the action was executed. |
| TRACE_ID | varchar(64) | YES | The Trace ID of the action. |
| COST_TIME | bigint(20) | YES | The time consumed by the action. |
| RET_CODE | bigint(20) | YES | The error code of the action. If the value is 0, the action was successful. |
| ERROR_MSG | varchar(512) | YES | The error message returned after the action failed. |
Typical tenant events
The following examples show typical tenant events for the TENANT ROLE CHANGE (primary/standby tenant switch), SERVICE NAME (service name), and DBMS_BALANCE modules.
The values of the NAME and VALUE columns vary depending on the module.
TENANT ROLE CHANGE
The TENANT ROLE CHANGE module provides the following operations: FAILOVER TO PRIMARY, SWITCHOVER TO PRIMARY, and SWITCHOVER TO STANDBY.
FAILOVER TO PRIMARY operation
When you initiate a
FAILOVER TO PRIMARYoperation, the following important events are recorded in the tenant event log table.FAILOVER TO PRIMARY START
This event records the specific moment when the
ALTER SYSTEM ACTIVATE STANDBYcommand is executed and the related tenant information.Attribute Attribute Value NAME1: STMT_STR VALUE1: The text of the command entered by the user NAME2: TENANT_INFO VALUE2: The status or information of the tenant at the time the command was initiated FAILOVER TO PRIMARY END
This event records the exact moment when the
ALTER SYSTEM ACTIVATE STANDBYcommand is completed, including the related tenant information, the final status of the log streams, and the time spent on key steps.Attribute Attribute Value NAME1: STMT_STR VALUE1: The text of the command entered by the user NAME2: TENANT_INFO VALUE2: The status or information of the tenant at the time the command was completed NAME3: FAILOVER_SCN VALUE3: The synchronization point after the tenant fails over NAME4: COST_DETAIL VALUE4: The time spent on each stage during command execution, in microseconds NAME5: ALL_LS VALUE5: The status of all log streams when the tenant modifies the ACCESS MODE
SWITCHOVER TO PRIMARY operation
When you initiate a
SWITCHOVER TO PRIMARYoperation, the following important events are recorded in the tenant event log table.SWITCHOVER TO PRIMARY START
This event records the specific moment when the
ALTER SYSTEM SWITCHOVER TO PRIMARYcommand is executed and the related tenant information.Attribute Attribute Value NAME1: STMT_STR VALUE1: The text of the command entered by the user NAME2: TENANT_INFO VALUE2: The status or information of the tenant at the time the command was initiated WAIT LOG SYNC
This event records the information about log synchronization for the tenant. When you execute the
ALTER SYSTEM SWITCHOVER TO PRIMARYcommand, the involved tenant must wait until all the latest log records are synchronized from the current primary tenant to ensure data consistency and integrity.Attribute Attribute Value NAME1: IS_SYS_LS_SYNCED VALUE1: Indicates whether the system log stream of the tenant is synchronized NAME2: IS_ALL_LS_SYNCED VALUE2: Indicates whether all log streams of the tenant are synchronized NAME3: NON_SYNC_INFO VALUE3: If there are unsynchronized log streams, the system will display the number of unsynchronized log streams and provide information about the top five log streams with the slowest synchronization speed. SWITCHOVER TO PRIMARY END
This event records the exact moment when the
ALTER SYSTEM SWITCHOVER TO PRIMARYcommand is completed, including the related tenant information, the final status of the log streams, and the time spent on key steps.Attribute Attribute Value NAME1: STMT_STR VALUE1: The text of the command entered by the user NAME2: TENANT_INFO VALUE2: The status or information of the tenant at the time the command was completed NAME3: SWITCHOVER_SCN VALUE3: The synchronization point after the tenant switches over NAME4: COST_DETAIL VALUE4: The time spent on each stage during command execution, in microseconds NAME5: ALL_LS VALUE5: The status of all log streams when the tenant modifies the ACCESS MODE
SWITCHOVER TO STANDBY operation
When you initiate a
SWITCHOVER TO STANDBYoperation, the following important events are recorded in the tenant event log table.SWITCHOVER TO STANDBY START
This event records the specific moment when the
ALTER SYSTEM SWITCHOVER TO STANDBYcommand is executed and the related tenant information.Attribute Attribute Value NAME1: STMT_STR VALUE1: The text of the command entered by the user NAME2: TENANT_INFO VALUE2: The status or information of the tenant at the time the command was initiated SWITCHOVER TO STANDBY END
This event records the exact moment when the
ALTER SYSTEM SWITCHOVER TO STANDBYcommand is completed, including the related tenant information, the final status of the log streams, and the time spent on key steps.Attribute Attribute Value NAME1: STMT_STR VALUE1: The text of the command entered by the user NAME2: TENANT_INFO VALUE2: The status or information of the tenant at the time the command was completed NAME3: SWITCHOVER_SCN VALUE3: The synchronization point after the tenant switches over NAME4: COST_DETAIL VALUE4: The time spent on each stage during command execution, in microseconds NAME5: ALL_LS VALUE5: The status of all log streams when the tenant modifies the ACCESS MODE
SERVICE NAME
The SERVICE NAME module provides the CREATE SERVICE, DELETE SERVICE, START SERVICE, and STOP SERVICE operations.
You can use the TRACE_ID to trace the execution of these operations. For example, you can find the event of creating a service and trace the broadcast triggered by the event based on the TRACE_ID of the event.
CREATE SERVICE
The following event is recorded when a user tenant is created.
BROADCAST SERVICE NAME
This event records the content of the broadcast, the list of OBServer nodes to which the broadcast is sent, and the list of OBServer nodes that successfully received the broadcast. When the
ALTER SYSTEM CREATE SERVICEcommand is executed, the OBServer node that initiates the command broadcasts the service name of the current tenant to all OBServer nodes where the units of the tenant are located.Attribute Value NAME1: EPOCH VALUE1: The version of the information about the service names of the current tenant in this broadcast. NAME2: TARGET_SERVICE_NAME_ID VALUE2: The service_name_idof the event that triggers this broadcast.NAME3: SERVICE_NAME_LIST VALUE3: The information about the service names of the current tenant. NAME4: SERVICE_NAME_COMMAND_TYPE VALUE4: The type of the operation that triggers this broadcast. NAME5: TARGET_SERVERS_LIST VALUE5: The list of OBServer nodes to which the broadcast is sent. These nodes are not permanently offline. NAME6: SUCCESS_SERVERS_LIST VALUE6: The list of OBServer nodes that successfully received the broadcast. CREATE SERVICE
This event records the name of the service to be created and the detailed information after the service is created. This event is generated after the
ALTER SYSTEM CREATE SERVICEcommand is executed.Attribute Value NAME1: SERVICE_NAME_STRING VALUE1: The name of the new service to be created. NAME2: CREATED_SERVICE_NAME VALUE2: The information about the created service.
DELETE SERVICE
The following event is recorded when a user tenant is deleted.
DELETE SERVICE
This event records the information at the time when the command is initiated. This event is generated after the
ALTER SYSTEM DELETE SERVICEcommand is executed.Attribute Value NAME1: DELETED_SERVICE_NAME VALUE1: The information about the service to be deleted.
START SERVICE
The following event is recorded when a user tenant is started.
BROADCAST SERVICE NAME
This event records the content of the broadcast, the list of OBServer nodes to which the broadcast is sent, and the list of OBServer nodes that successfully received the broadcast. When the
ALTER SYSTEM SERVICE NAMEcommand is executed, the OBServer node that initiates the command broadcasts the service name of the current tenant to all OBServer nodes where the units of the tenant are located.Attribute Value NAME1: EPOCH VALUE1: The version of the information about the service names of the current tenant in this broadcast. NAME2: TARGET_SERVICE_NAME_ID VALUE2: The service _name _idof the event that triggers this broadcast.NAME3: SERVICE_NAME_LIST VALUE3: The service_nameof the current tenant.NAME4: SERVICE_NAME_COMMAND_TYPE VALUE4: The type of the operation that triggers this broadcast. NAME5: TARGET_SERVERS_LIST VALUE5: The list of OBServer nodes to which the broadcast is sent. These nodes are not permanently offline. NAME6: SUCCESS_SERVERS_LIST VALUE6: The list of OBServer nodes that successfully received the broadcast. START SERVICE
This event records the information at the time when the command is initiated and the time when the command is completed. This event is generated after the
ALTER SYSTEM START SERVICEcommand is executed.Attribute Value NAME1: SERVICE_NAME_BEFORE VALUE1: The information about the service name before the service is started. NAME2: SERVICE_NAME_AFTER VALUE2: The information about the service name after the service is started.
STOP SERVICE
The following event is recorded when a user tenant is stopped.
KILL CONNECTIONS OF SERVICE NAME
Each OBServer node terminates the connections established by using the service name to be stopped, and generates a record in the tenant event view. If no connections are established by using the service name to be stopped on an OBServer node, the event is not recorded in the table.
Attribute Value NAME1: SERVICE_NAME VALUE1: The information about the service name to be stopped. NAME2: KILLED_CONNECTIONS_COUNT VALUE2: The number of terminated connections. NAME3: KILLED_CONNECTIONS_LIST VALUE3: The IDs of the terminated connections. BROADCAST SERVICE NAME
This event records the content of the broadcast, the list of OBServer nodes to which the broadcast is sent, and the list of OBServer nodes that successfully received the broadcast. When the
ALTER SYSTEM STOP SERVICEcommand is executed, the OBServer node that initiates the command broadcasts the service name of the current tenant to all OBServer nodes where the units of the tenant are located.Attribute Value NAME1: EPOCH VALUE1: The version of the information about the service names of the current tenant in this broadcast. NAME2: TARGET_SERVICE_NAME _ID VALUE2: The service _name _idof the event that triggers this broadcast.NAME3: SERVICE_NAME_LIST VALUE3: The service_nameof the current tenant.NAME4: SERVICE_NAME_COMMAND_TYPE VALUE4: The type of the operation that triggers this broadcast. NAME5: TARGET_SERVERS_LIST VALUE5: The list of OBServer nodes to which the broadcast is sent. These nodes are not permanently offline. NAME6: SUCCESS_SERVERS_LIST VALUE6: The list of OBServer nodes that successfully received the broadcast. STOP SERVICE
This event records the information at the time when the command is initiated and the time when the command is completed. This event is generated after the
ALTER SYSTEM STOP SERVICEcommand is executed.Property Property Value NAME1: SERVICE_NAME_BEFORE VALUE1: Information about the service name before the service is stopped. NAME2: SERVICE_NAME_AFTER VALUE2: Information about the service name after the service is stopped.
DBMS_BALANCE
The DBMS_BALANCE module provides four operations: TRIGGER PARTITION BALANCE, SET BALANCE WEIGHT, CLEAR BALANCE WEIGHT, and CLEAR EXPIRED BALANCE WEIGHT.
TRIGGER PARTITION BALANCE
When you execute the
DBMS_BALANCE.TRIGGER_PARTITION_BALANCEoperation, the system records aTRIGGER PARTITION BALANCEevent in the tenant event record table.The
TRIGGER PARTITION BALANCEevent records the specific time when theDBMS_BALANCE.TRIGGER_PARTITION_BALANCEcommand was executed and the related parameters.Attribute Value NAME1: BALANCE_TIMEOUT_S VALUE1: The timeout parameter for triggering balance, in seconds. SET BALANCE WEIGHT
When you execute the
DBMS_BALANCE.SET_BALANCE_WEIGHToperation, the system records aSET BALANCE WEIGHTevent in the tenant event record table.The
SET BALANCE WEIGHTevent records the specific time when theDBMS_BALANCE.SET_BALANCE_WEIGHTcommand was executed and the related parameters.Attribute Value NAME1: WEIGHT VALUE1: The weight of the partition. NAME2: DATABASE_NAME VALUE2: The name of the database to which the partition belongs. NAME3: TABLE_NAME VALUE3: The name of the table to which the partition belongs. NAME4: PARTITION_NAME VALUE4: The name of the partition to which the weight is set. NAME5: SUBPARTITION_NAME VALUE5: The name of the subpartition to which the weight is set. CLEAR BALANCE WEIGHT
When you execute the
DBMS_BALANCE.CLEAR_BALANCE_WEIGHToperation, the system records aCLEAR BALANCE WEIGHTevent in the tenant event record table.The
CLEAR BALANCE WEIGHTevent records the specific time when theDBMS_BALANCE.CLEAR_BALANCE_WEIGHTcommand was executed and the related parameters.Attribute Value NAME1: DATABASE_NAME VALUE1: The name of the database to which the partition belongs. NAME2: TABLE_NAME VALUE2: The name of the table to which the partition belongs. NAME3: PARTITION_NAME VALUE3: The name of the partition to which the weight is cleared. NAME4: SUBPARTITION_NAME VALUE4: The name of the subpartition to which the weight is cleared. CLEAR EXPIRED BALANCE WEIGHT
When a background thread clears the weights of expired partitions, the system records a
CLEAR EXPIRED BALANCE WEIGHTevent in the tenant event record table.The
CLEAR EXPIRED BALANCE WEIGHTevent records the specific time when the background thread cleared the weights of expired partitions and the related parameters.Attribute Value NAME1: TABLE_NAME VALUE1: The name of the table to which the expired partition belongs. NAME2: PARTITION_NAME VALUE2: The name of the partition to which the expired partition belongs. NAME3: SUBPARTITION_NAME VALUE3: The name of the subpartition to which the expired partition belongs.
Sample query
Query the history of operations in the current tenant and display the first record.
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_TENANT_EVENT_HISTORY LIMIT 1\G
The query result is as follows:
*************************** 1. row ***************************
TIMESTAMP: 2023-12-14 14:33:20.321725
MODULE: TENANT ROLE CHANGE
EVENT: SWITCHOVER TO STANDBY END
NAME1: STMT_STR
VALUE1: ALTER SYSTEM SWITCHOVER TO STANDBY TENANT backup_mysql_tenant
NAME2: TENANT_INFO
VALUE2: {tenant_id:1002, tenant_role:"STANDBY", switchover_status:"NORMAL", switchover_epoch:1702535600271677, sync_scn:1702535620070597000, replayable_scn:1702535620070597000, readable_scn:1702535620070597000, recovery_until_scn:4611686018427387903, log_mode:"ARCHIVELOG", max_ls_id:1003}
NAME3: SWITCHOVER_SCN
VALUE3: 1702535620070597000
NAME4: COST_DETAIL
VALUE4: WAIT_LOG_END: 100190, CHANGE_ACCESS_MODE: 47261, OTHERS: 136839
NAME5: ALL_LS
VALUE5: NORMAL: 1, 1001, 1002, 1003
NAME6: NULL
VALUE6:
EXTRA_INFO: NULL
SVR_IP: 100.xx.xx.xx
SVR_PORT: 13324
TRACE_ID: Y340C64586BD4-00060C724AEB962B-0-0
COST_TIME: 284290
RET_CODE: 0
ERROR_MSG: NULL
1 row in set