Note
This view was introduced in OceanBase Database V4.0.0.
Purpose
The oceanbase.DBA_OB_TENANTS view displays the basic information of tenants.
- When you query this view from the
systenant, the view displays the basic information of all tenants, including thesystenant, user tenants, and meta tenants. You can determine the tenant type based on theTENANT_TYPEcolumn. - When you query this view from a user tenant, only the information of the current tenant is displayed.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| TENANT_ID | bigint(20) | NO | The ID of the tenant. Valid values:
|
| TENANT_NAME | varchar(128) | NO | The name of the tenant. |
| TENANT_TYPE | varchar(4) | NO | The type of the tenant. Valid values:
|
| CREATE_TIME | timestamp(6) | YES | The time when the tenant was created. |
| MODIFY_TIME | timestamp(6) | YES | The time when the tenant was last modified. |
| PRIMARY_ZONE | varchar(128) | YES | The primary zone of the tenant. |
| LOCALITY | varchar(4096) | NO | The locality of the tenant. |
| PREVIOUS_LOCALITY | varchar(4096) | NO | The locality before the change.
|
| COMPATIBILITY_MODE | varchar(6) | NO | The compatibility mode. Valid values:
|
| STATUS | varchar(64) | NO | The current status of the tenant. Valid values:
|
| IN_RECYCLEBIN | varchar(3) | NO | Indicates whether the tenant has been dropped and is in the recycle bin. Valid values:
|
| LOCKED | varchar(3) | NO | Indicates whether the tenant is locked. Valid values:
ALTER TENANT xxx LOCK\|UNLOCK command. |
| TENANT_ROLE | varchar(100) | NO | The role of the tenant in the cluster. Valid values:
NoteThis column was introduced in OceanBase Database V4.1.0. |
| SWITCHOVER_STATUS | varchar(100) | NO | The switchover status. Valid values:
NoteThis column was introduced in OceanBase Database V4.1.0. |
| SWITCHOVER_EPOCH | bigint(20) | NO | The unique ID of the switchover or failover.
NoteThis column is available in OceanBase Database V4.1.0 and later. |
| SYNC_SCN | bigint(20) unsigned | NO | The snapshot version that has been synchronized for the current tenant. The value is NULL for the sys tenant or a meta tenant.
NoteThis column is available in OceanBase Database V4.1.0 and later. |
| REPLAYABLE_SCN | bigint(20) unsigned | NO | The snapshot version that can be replayed for the current tenant. The value is NULL for the sys tenant or a meta tenant.
NoteThis column is available in OceanBase Database V4.1.0 and later. |
| READABLE_SCN | bigint(20) unsigned | NO | The snapshot version that can be read for the current tenant. The value is NULL for the sys tenant or a meta tenant.
NoteThis column is available in OceanBase Database V4.1.0 and later. |
| RECOVERY_UNTIL_SCN | bigint(20) unsigned | NO | The maximum system change number (SCN) that can be restored for the current tenant. The value is NULL for the sys tenant or a meta tenant.
NoteThis column is available in OceanBase Database V4.1.0 and later. |
| LOG_MODE | varchar(100) | NO | The log archiving mode. Valid values:
NoteThis column was introduced in OceanBase Database V4.1.0. |
| ARBITRATION_SERVICE_STATUS | varchar(64) | NO | The arbitration service status of the tenant. Valid values:
NoteThis column was introduced in OceanBase Database V4.1.0. |
| UNIT_NUM | bigint(20) | NO | The number of resource units in each zone.
NoteThis column is available in OceanBase Database V4.2.0 and later. |
| COMPATIBLE | varchar(65536) | NO | The compatibility version.
NoteThis column is available in OceanBase Database V4.2.0 and later. |
| MAX_LS_ID | bigint(20) | NO | The maximum log stream ID of the tenant. The value is 1 for the sys tenant or a meta tenant. For a user tenant, the value varies based on the actual situation.
NoteThis column is available in OceanBase Database V4.2.0 and later. |
Sample query
Query the basic information of all tenants from the sys tenant.
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_TENANTS\G
The query result is as follows:
*************************** 1. row ***************************
TENANT_ID: 1
TENANT_NAME: sys
TENANT_TYPE: SYS
CREATE_TIME: 2024-07-23 15:16:40.931141
MODIFY_TIME: 2024-07-23 15:16:40.931141
PRIMARY_ZONE: RANDOM
LOCALITY: FULL{1}@zone1
PREVIOUS_LOCALITY: NULL
COMPATIBILITY_MODE: MYSQL
STATUS: NORMAL
IN_RECYCLEBIN: NO
LOCKED: NO
TENANT_ROLE: PRIMARY
SWITCHOVER_STATUS: NORMAL
SWITCHOVER_EPOCH: 0
SYNC_SCN: NULL
REPLAYABLE_SCN: NULL
READABLE_SCN: NULL
RECOVERY_UNTIL_SCN: NULL
LOG_MODE: NOARCHIVELOG
ARBITRATION_SERVICE_STATUS: DISABLED
UNIT_NUM: 1
COMPATIBLE: 4.2.4.0
MAX_LS_ID: 1
*************************** 2. row ***************************
TENANT_ID: 1001
TENANT_NAME: META$1002
TENANT_TYPE: META
CREATE_TIME: 2024-07-23 15:19:41.217729
MODIFY_TIME: 2024-07-23 15:20:00.483121
PRIMARY_ZONE: zone1
LOCALITY: FULL{1}@zone1
PREVIOUS_LOCALITY: NULL
COMPATIBILITY_MODE: MYSQL
STATUS: NORMAL
IN_RECYCLEBIN: NO
LOCKED: NO
TENANT_ROLE: PRIMARY
SWITCHOVER_STATUS: NORMAL
SWITCHOVER_EPOCH: 0
SYNC_SCN: NULL
REPLAYABLE_SCN: NULL
READABLE_SCN: NULL
RECOVERY_UNTIL_SCN: NULL
LOG_MODE: NOARCHIVELOG
ARBITRATION_SERVICE_STATUS: DISABLED
UNIT_NUM: 1
COMPATIBLE: 4.2.4.0
MAX_LS_ID: 1
*************************** 3. row ***************************
TENANT_ID: 1002
TENANT_NAME: mysql001
TENANT_TYPE: USER
CREATE_TIME: 2024-07-23 15:19:41.221868
MODIFY_TIME: 2024-07-23 15:20:00.528502
PRIMARY_ZONE: zone1
LOCALITY: FULL{1}@zone1
PREVIOUS_LOCALITY: NULL
COMPATIBILITY_MODE: MYSQL
STATUS: NORMAL
IN_RECYCLEBIN: NO
LOCKED: NO
TENANT_ROLE: PRIMARY
SWITCHOVER_STATUS: NORMAL
SWITCHOVER_EPOCH: 0
SYNC_SCN: 1722851551503553004
REPLAYABLE_SCN: 1722851551503553004
READABLE_SCN: 1722851551503553003
RECOVERY_UNTIL_SCN: 4611686018427387903
LOG_MODE: NOARCHIVELOG
ARBITRATION_SERVICE_STATUS: DISABLED
UNIT_NUM: 1
COMPATIBLE: 4.2.4.0
MAX_LS_ID: 1001
*************************** 4. row ***************************
TENANT_ID: 1003
TENANT_NAME: META$1004
TENANT_TYPE: META
CREATE_TIME: 2024-07-23 15:20:21.007329
MODIFY_TIME: 2024-07-23 15:20:41.802667
PRIMARY_ZONE: zone1
LOCALITY: FULL{1}@zone1
PREVIOUS_LOCALITY: NULL
COMPATIBILITY_MODE: MYSQL
STATUS: NORMAL
IN_RECYCLEBIN: NO
LOCKED: NO
TENANT_ROLE: PRIMARY
SWITCHOVER_STATUS: NORMAL
SWITCHOVER_EPOCH: 0
SYNC_SCN: NULL
REPLAYABLE_SCN: NULL
READABLE_SCN: NULL
RECOVERY_UNTIL_SCN: NULL
LOG_MODE: NOARCHIVELOG
ARBITRATION_SERVICE_STATUS: DISABLED
UNIT_NUM: 1
COMPATIBLE: 4.2.4.0
MAX_LS_ID: 1
*************************** 5. row ***************************
TENANT_ID: 1004
TENANT_NAME: oracle001
TENANT_TYPE: USER
CREATE_TIME: 2024-07-23 15:20:21.008367
MODIFY_TIME: 2024-07-23 15:20:41.838510
PRIMARY_ZONE: zone1
LOCALITY: FULL{1}@zone1
PREVIOUS_LOCALITY: NULL
COMPATIBILITY_MODE: ORACLE
STATUS: NORMAL
IN_RECYCLEBIN: NO
LOCKED: NO
TENANT_ROLE: PRIMARY
SWITCHOVER_STATUS: NORMAL
SWITCHOVER_EPOCH: 0
SYNC_SCN: 1722851552042018000
REPLAYABLE_SCN: 1722851552042018000
READABLE_SCN: 1722851552042018000
RECOVERY_UNTIL_SCN: 4611686018427387903
LOG_MODE: NOARCHIVELOG
ARBITRATION_SERVICE_STATUS: DISABLED
UNIT_NUM: 1
COMPATIBLE: 4.2.4.0
MAX_LS_ID: 1001
5 rows in set