Initiate a log backup

2023-10-27 09:57:43  Updated

This topic describes how to initiate a log backup after you prepare for backup.

Prerequisites

Preparations for backup are completed.

Procedure

  1. Log on to the sys tenant as the root user.

  2. (Optional) Configure the backup mode and enable compression of archived logs.

    • The backup mode can be configured as Optional or Mandatory. The default backup mode is Optional.

      • The optional mode prioritizes user business. In this mode, logs may be recycled before they are archived, interrupting the backup.

      • The mandatory mode prioritizes backup. In this mode, you may be unable to write more data before existing data is backed up.

    • You can use the zstd_1.3.8 and lz4_1.0 algorithms to compress archived logs. The default compression algorithm is lz4_1.0.

    The following example selects the optional mode and enables the compression of archived logs:

    obclient> ALTER SYSTEM SET backup_log_archive_option = 'optional compression= enable';
    

    You can dynamically switch the compression algorithm as needed by executing the following statement:

    obclient> ALTER SYSTEM SET backup_log_archive_option='optional compression= zstd_1.3.8';
    
    obclient> ALTER SYSTEM SET backup_log_archive_option='optional compression= lz4_1.0';
    

    Note

    To disable the compression of archived logs, execute the following statement:

    • In optional mode, you can either execute the ALTER SYSTEM SET backup_log_archive_option = 'compression= disable'; statement to disable compression, or execute the ALTER SYSTEM SET backup_log_archive_option = 'mandatory compression= disable'; statement to configure the backup mode and disable log compression.
    • In mandatory mode, you can only execute the ALTER SYSTEM SET backup_log_archive_option = 'optional compression= disable'; statement to configure the backup mode and disable log compression.

  3. Execute the following statement to enable log backup:

    Note

    To save some time, we recommend that you initiate a minor compaction before enabling log backup. This is because log backup starts from the last minor compaction. For more information about how to initiate a minor compaction, see Manually initiate a minor compaction.

    obclient> ALTER SYSTEM ARCHIVELOG;
    

    After log backup is enabled, OceanBase Database regularly backs up the transaction logs generated by the clusters to the specified destination.

  4. Execute the following statement to check whether the log backup task is started:

    obclient> SELECT * FROM CDB_OB_BACKUP_ARCHIVELOG;
    

    When STATUS is DOING, the log backup task is started.

    For more information about fields in CDB_OB_BACKUP_ARCHIVELOG, see CDB_OB_BACKUP_ARCHIVELOG.

  5. Execute the following statement to view the status of backup pieces in the backup set:

    obclient> SELECT * FROM CDB_OB_BACKUP_PIECE_FILES;
    

    For more information about fields in CDB_OB_BACKUP_PIECE_FILES, see CDB_OB_BACKUP_PIECE_FILES.

Contact Us