Query the backup cleanup progress

2023-12-01 03:27:20  Updated

After a cleanup strategy is configured and automatic cleanup is triggered, expired backup data will be automatically cleaned up based on the strategy. You can query the backup cleanup progress.

Query views for the backup cleanup progress

  1. Log on to the database as an administrator of the sys tenant or a user tenant.

  2. Query the backup cleanup progress.

    1. Query the progress of backup cleanup jobs.

      You can query the CDB_OB_BACKUP_DELETE_JOBS view from the sys tenant for the progress of cleanup jobs of all tenants, and query the DBA_OB_BACKUP_DELETE_JOBS view from a user tenant for the progress of cleanup jobs of the current tenant.

      To query the progress of the cleanup jobs of all user tenants from the sys tenant, execute the following statement:

      obclient> SELECT * FROM oceanbase.CDB_OB_BACKUP_DELETE_JOBS\G
      *************************** 1. row ***************************
                     TENANT_ID: 1002
                        JOB_ID: 7
                   INCARNATION: 1
           INITIATOR_TENANT_ID: 1002
              INITIATOR_JOB_ID: 7
            EXECUTOR_TENANT_ID: 1002
                          TYPE: DELETE OBSOLETE BACKUP
                     PARAMETER: 2022-05-31 12:09:40.060284
                     JOB_LEVEL: USER_TENANT
               START_TIMESTAMP: 2022-06-01 12:09:53.389512
                 END_TIMESTAMP:
                        STATUS: DOING
                    TASK_COUNT: 2
            SUCCESS_TASK_COUNT: 1
                        RESULT: 0
                       COMMENT:
      1 row in set
      

      A job for cleaning up expired backup data is initiated at 2022-06-01 12:09:53.389512 from the user tenant with the ID 1002. The backup data expired at or earlier than 2022-05-31 12:09:40.060284 is cleaned up. Therefore, the value of the recovery_window parameter in the cleanup strategy of this tenant is 1d. The value of TASK_COUNT is 2, indicating that two backup set or backup piece cleanup tasks are being executed. The value of SUCCESS_TASK_COUNT is 1, indicating that one task has been completed. Therefore, the task completion rate is 50%, which is calculated by using the following formula: SUCCESS_TASK_COUNT/TASK_COUNT × 100%.

    2. Query the progress of the backup set/backup piece cleanup tasks.

      You can query the CDB_OB_BACKUP_DELETE_TASKS view from the sys tenant for the progress of backup set/backup piece cleanup tasks of all tenants, and query the DBA_OB_BACKUP_DELETE_TASKS view from a user tenant for the progress of backup set/backup piece cleanup tasks of the current tenant.

      To query the progress of the backup set/backup piece cleanup tasks of all tenants from the sys tenant, execute the following statement:

      obclient> SELECT * FROM oceanbase.CDB_OB_BACKUP_DELETE_TASKS\G
      *************************** 1. row ***************************
               TENANT_ID: 1002
                 TASK_ID: 4
             INCARNATION: 1
                  JOB_ID: 7
               TASK_TYPE: BACKUP SET
                      ID: 1
                ROUND_ID: 0
                 DEST_ID: 1002
         START_TIMESTAMP: 2022-06-01 12:09:50.800772
           END_TIMESTAMP: 2022-06-01 12:09:54.954691
                  STATUS: COMPLETED
          TOTAL_LS_COUNT: 2
         FINISH_LS_COUNT: 2
                  RESULT: 0
                 COMMENT:
                    PATH: file:///data/nfs/backup/data
      *************************** 2. row ***************************
               TENANT_ID: 1002
                 TASK_ID: 5
             INCARNATION: 1
                  JOB_ID: 7
               TASK_TYPE: BACKUP PIECE
                      ID: 1
                ROUND_ID: 1
                 DEST_ID: 1001
         START_TIMESTAMP: 2022-06-01 12:09:50.968413
           END_TIMESTAMP:
                  STATUS: DOING
          TOTAL_LS_COUNT: 2
         FINISH_LS_COUNT: 1
                  RESULT: 0
                 COMMENT:
                    PATH: file:///data/nfs/backup/archive
      2 rows in set
      

      According to the query result, the backup file of the data backup with backup_set_id=1 in the destination file:///data/nfs/backup/data has been deleted, and the task completion rate is 100%, which is calculated by using the following formula: FINISH_LS_COUNT/TOTAL_LS_COUNT × 100%. In the destination file:///data/nfs/backup/archive, the backup file of archive logs with round_id=1/backup_piece_id=1 is being deleted, and the task completion rate is 50%, which is calculated by using the following formula: FINISH_LS_COUNT/TOTAL_LS_COUNT × 100%. You can query the information about the initiated cleanup tasks in the job-level view based on JOB_ID.

References

Query the backup cleanup history

Contact Us