After you enable log archiving, you can query for the archiving progress from the corresponding view.
View the archiving progress of all tenants from the sys tenant
You can query the oceanbase.CDB_OB_ARCHIVELOG view from the sys tenant for the archiving progress of all tenants in the current cluster.
Log in to the
systenant of the cluster as therootuser.Execute the following statement to query the log archiving progress:
obclient [(none)]> SELECT * FROM oceanbase.CDB_OB_ARCHIVELOG\G *************************** 1. row *************************** TENANT_ID: 1002 DEST_ID: 1002 ROUND_ID: 2 INCARNATION: 1 DEST_NO: 0 STATUS: DOING START_SCN: 1655697600000000000 START_SCN_DISPLAY: 2022-06-20 12:00:00.000000 CHECKPOINT_SCN: 1655769600000000000 CHECKPOINT_SCN_DISPLAY: 2022-06-21 08:00:00.000000 COMPATIBLE: 1 BASE_PIECE_ID: 4 USED_PIECE_ID: 4 PIECE_SWITCH_INTERVAL: 1d INPUT_BYTES: 16106127360 INPUT_BYTES_DISPLAY: 15.00GB OUTPUT_BYTES: 16106127360 OUTPUT_BYTES_DISPLAY: 15.00GB COMPRESSION_RATIO: 1.00 DELETED_INPUT_BYTES: 0 DELETED_INPUT_BYTES_DISPLAY: 0.00MB DELETED_OUTPUT_BYTES: 0 DELETED_OUTPUT_BYTES_DISPLAY: 0.00MB COMMENT: PATH: file:///data/nfs/backup/archive *************************** 2. row *************************** TENANT_ID: 1004 DEST_ID: 1001 ROUND_ID: 1 INCARNATION: 1 DEST_NO: 0 STATUS: DOING START_SCN: 1655658000000000000 START_SCN_DISPLAY: 2022-06-20 01:00:00.000000 CHECKPOINT_SCN: 1655769600000000000 CHECKPOINT_SCN_DISPLAY: 2022-06-21 08:00:00.000000 COMPATIBLE: 1 BASE_PIECE_ID: 1 USED_PIECE_ID: 2 PIECE_SWITCH_INTERVAL: 1d INPUT_BYTES: 161061273600 INPUT_BYTES_DISPLAY: 150.00GB OUTPUT_BYTES: 161061273600 OUTPUT_BYTES_DISPLAY: 150.00GB COMPRESSION_RATIO: 1.00 DELETED_INPUT_BYTES: 0 DELETED_INPUT_BYTES_DISPLAY: 0.00MB DELETED_OUTPUT_BYTES: 0 DELETED_OUTPUT_BYTES_DISPLAY: 0.00MB COMMENT: PATH: oss://oceanbase-test-bucket/backup/archive?host=xxx.aliyun-inc.com 2 row in setIn the preceding example, the current cluster contains two tenants with the IDs
1002and1004, and archiving is in progress for the two tenants.round_idof tenant1002is2, indicating that log archiving is enabled the second time. The archive destination type isNFS, and the archive path is/data/nfs/backup/archive. One piece, with the piece ID4, has been generated since log archiving was enabled. Logs whose system change numbers (SCNs) fall within the range of'2022-06-20 12:00:00.000000'to'2022-06-21 08:00:00.000000'are archived.round_idof tenant1004is1, indicating that log archiving is enabled the first time. The archive destination type isOSS, the bucket isoceanbase-test-bucket, and the archive path is/backup/archive. Two pieces with the piece IDs1and2have been generated since log archiving was enabled. Logs whose SCNs fall within the range of'2022-06-20 01:00:00.000000'to'2022-06-21 08:00:00.000000'are archived.
View the archiving progress of a user tenant
You can query the oceanbase.DBA_OB_ARCHIVELOG view from a MySQL tenant or the sys.DBA_OB_ARCHIVELOG view from an Oracle tenant for the archiving progress of the tenant.
Log in to the database as a tenant administrator.
Note
The administrator user is the
rootuser in a MySQL tenant and theSYSuser in an Oracle tenant.Query the log archiving progress of the current tenant.
To query the log archiving progress of a MySQL tenant, execute the following statement:
obclient [(none)]> SELECT * FROM oceanbase.DBA_OB_ARCHIVELOG\G *************************** 1. row *************************** DEST_ID: 1002 ROUND_ID: 2 INCARNATION: 1 DEST_NO: 0 STATUS: DOING START_SCN: 1655697600000000000 START_SCN_DISPLAY: 2022-06-20 12:00:00.000000 CHECKPOINT_SCN: 1655769600000000000 CHECKPOINT_SCN_DISPLAY: 2022-06-21 08:00:00.000000 COMPATIBLE: 1 BASE_PIECE_ID: 4 USED_PIECE_ID: 4 PIECE_SWITCH_INTERVAL: 1d INPUT_BYTES: 16106127360 INPUT_BYTES_DISPLAY: 15.00GB OUTPUT_BYTES: 16106127360 OUTPUT_BYTES_DISPLAY: 15.00GB COMPRESSION_RATIO: 1.00 DELETED_INPUT_BYTES: 0 DELETED_INPUT_BYTES_DISPLAY: 0.00MB DELETED_OUTPUT_BYTES: 0 DELETED_OUTPUT_BYTES_DISPLAY: 0.00MB COMMENT: PATH: file:///data/nfs/backup/archive 1 row in set