This topic describes how to query the locality change history from the DBA_OB_TENANT_JOBS view.
For more information about the DBA_OB_TENANT_JOBS view, see DBA_OB_TENANT_JOBS.
Procedure
Log on to the
systenant of the cluster as therootuser.obclient -h172.30.xxx.xxx -P2883 -uroot@sys#obdemo -pxxxx -AAccess the database named
oceanbase.obclient>use oceanbase;View locality change jobs.
View the execution status of locality change jobs.
obclient> SELECT * FROM oceanbase.DBA_OB_TENANT_JOBS WHERE JOB_TYPE = 'ALTER_TENANT_LOCALITY'; +--------+-----------------------+------------+-------------+----------+----------------------------+----------------------------+-----------+------------------------------------------------------------------------------+---------------------------------------------+----------------+-------------+ | JOB_ID | JOB_TYPE | JOB_STATUS | RESULT_CODE | PROGRESS | START_TIME | MODIFY_TIME | TENANT_ID | SQL_TEXT | EXTRA_INFO | RS_SVR_IP | RS_SVR_PORT | +--------+-----------------------+------------+-------------+----------+----------------------------+----------------------------+-----------+------------------------------------------------------------------------------+---------------------------------------------+----------------+-------------+ | 1 | ALTER_TENANT_LOCALITY | SUCCESS | 0 | 100 | 2023-01-05 19:33:46.730319 | 2023-01-05 19:33:46.920111 | 1002 | ALTER TENANT mysql001 locality='FULL{1}@zone1, FULL{1}@zone2' | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 | xx.xx.xx.206 | 2882 | | 2 | ALTER_TENANT_LOCALITY | SUCCESS | 0 | 100 | 2023-01-05 19:38:38.416011 | 2023-01-05 19:40:11.019113 | 1002 | ALTER TENANT mysql001 locality='FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3' | FULL{1}@zone1, FULL{1}@zone2 | xx.xx.xx.207 | 2882 | | 3 | ALTER_TENANT_LOCALITY | SUCCESS | 0 | 100 | 2023-01-06 14:37:01.569689 | 2023-01-06 14:37:01.726090 | 1002 | ALTER TENANT mysql001 locality="FULL{1}@zone1, FULL{1}@zone2" | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 | xx.xx.xx.208 | 2882 | | 4 | ALTER_TENANT_LOCALITY | SUCCESS | 0 | 100 | 2023-01-06 14:39:56.377599 | 2023-01-06 14:40:57.874498 | 1002 | ALTER TENANT mysql001 locality="FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3" | FULL{1}@zone1, FULL{1}@zone2 | xx.xx.xx.209 | 2882 | +--------+-----------------------+------------+-------------+----------+----------------------------+----------------------------+-----------+------------------------------------------------------------------------------+---------------------------------------------+----------------+-------------+View the locality change history of a tenant.
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_OB_TENANT_JOBS WHERE JOB_TYPE = 'ALTER_TENANT_LOCALITY' AND tenant_id = 1002 ORDER BY START_TIME DESC LIMIT 10; +--------+-----------------------+------------+-------------+----------+----------------------------+----------------------------+-----------+------------------------------------------------------------------------------+---------------------------------------------+----------------+-------------+ | JOB_ID | JOB_TYPE | JOB_STATUS | RESULT_CODE | PROGRESS | START_TIME | MODIFY_TIME | TENANT_ID | SQL_TEXT | EXTRA_INFO | RS_SVR_IP | RS_SVR_PORT | +--------+-----------------------+------------+-------------+----------+----------------------------+----------------------------+-----------+------------------------------------------------------------------------------+---------------------------------------------+----------------+-------------+ | 4 | ALTER_TENANT_LOCALITY | SUCCESS | 0 | 100 | 2023-01-06 14:39:56.377599 | 2023-01-06 14:40:57.874498 | 1002 | ALTER TENANT mysql001 locality="FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3" | FULL{1}@zone1, FULL{1}@zone2 | xx.xx.xx.209 | 2882 | | 3 | ALTER_TENANT_LOCALITY | SUCCESS | 0 | 100 | 2023-01-06 14:37:01.569689 | 2023-01-06 14:37:01.726090 | 1002 | ALTER TENANT mysql001 locality="FULL{1}@zone1, FULL{1}@zone2" | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 | xx.xx.xx.206 | 2882 | | 2 | ALTER_TENANT_LOCALITY | SUCCESS | 0 | 100 | 2023-01-05 19:38:38.416011 | 2023-01-05 19:40:11.019113 | 1002 | ALTER TENANT mysql001 locality='FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3' | FULL{1}@zone1, FULL{1}@zone2 | xx.xx.xx.207 | 2882 | | 1 | ALTER_TENANT_LOCALITY | SUCCESS | 0 | 100 | 2023-01-05 19:33:46.730319 | 2023-01-05 19:33:46.920111 | 1002 | ALTER TENANT mysql001 locality='FULL{1}@zone1, FULL{1}@zone2' | FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3 | xx.xx.xx.208 | 2882 | +--------+-----------------------+------------+-------------+----------+----------------------------+----------------------------+-----------+------------------------------------------------------------------------------+---------------------------------------------+----------------+-------------+The query results are described as follows:
The job with the ID of
4is used an example. The job for changing the locality of the tenant with the ID of1002fromFULL{1}@zone1, FULL{1}@zone2toFULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3was created at2023-01-06 14:39:56.377599and was completed at2023-01-06 14:40:57.874498.