Purpose
The oceanbase.CDB_OB_TENANT_EVENT_HISTORY view displays the historical operation records of all tenants in the current cluster. You can query this view only from the sys tenant.
Note
This view is introduced since OceanBase Database V4.2.0.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| TENANT_ID | bigint(20) | NO | The ID of the tenant. |
| TIMESTAMP | timestamp(6) | NO | The time when the operation was executed, in microseconds. |
| MODULE | varchar(256) | NO | The name of the module. |
| EVENT | varchar(256) | NO | The name of the event. |
| 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 | The additional information. |
| SVR_IP | varchar(46) | YES | The IP address of the OBServer node on which the operation was executed. |
| SVR_PORT | bigint(20) | YES | The port number of the OBServer node on which the operation was executed. |
| TRACE_ID | varchar(64) | YES | The trace ID of the operation. |
| COST_TIME | bigint(20) | YES | The time taken to execute the operation. |
| RET_CODE | bigint(20) | YES | The error code for the operation. The value 0 indicates that the operation was successfully executed. |
| ERROR_MSG | varchar(512) | YES | The error message. |
Sample query
obclient [oceanbase]> SELECT * FROM oceanbase.CDB_OB_TENANT_EVENT_HISTORY WHERE TENANT_ID = 1002 AND EVENT = 'SWITCHOVER TO STANDBY END'\G
The query result is as follows:
*************************** 1. row ***************************
TENANT_ID: 1002
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