OceanBase Database V2.2.77 and later support log splitting, a feature that splits the log backups into multiple backup pieces based on a specified interval, and stores them in different directories. After log splitting is enabled, the administrator can choose to copy the split log backups when performing secondary backup.
Procedure
Log on to the database as the root user of the sys tenant.
Enable log splitting by specifying
log_archive_piece_switch_intervalin thebackup_dest_optionconfiguration item.Example:
obclient> ALTER SYSTEM SET backup_dest_option='recovery_window=7d&auto_delete_obsolete_backup=true&backup_copies=2&log_archive_piece_switch_interval=1d';In the example, a backup piece is split from the log backups every day and retained for seven days. By setting
backup_copiesto2, the original backup is only recycled after its secondary backup is performed. For more information aboutbackup_dest_option, see backup_dest_option.After you enable log splitting, you can view the progress of log backup and the information about the splitting of logs.
View the progress of log backup
obclient> SELECT * FROM CDB_OB_BACKUP_ARCHIVELOG; +-------------+-------------------+-----------+--------+----------------+-----------------+----------------------------+----------------------------+-------------+--------------+-------------------+---------------------+----------------------+ | INCARNATION | LOG_ARCHIVE_ROUND | TENANT_ID | STATUS | START_PIECE_ID | BACKUP_PIECE_ID | MIN_FIRST_TIME | MAX_NEXT_TIME | INPUT_BYTES | OUTPUT_BYTES | COMPRESSION_RATIO | INPUT_BYTES_DISPLAY | OUTPUT_BYTES_DISPLAY | +-------------+-------------------+-----------+--------+----------------+-----------------+----------------------------+----------------------------+-------------+--------------+-------------------+---------------------+----------------------+ | 1 | 1 | 1 | DOING | 1 | 12 | 2021-04-30 00:00:28.197301 | 2021-04-30 11:33:41.845543 | 0 | 0 | NULL | 0.00MB | 0.00MB | | 1 | 1 | 1001 | DOING | 1 | 12 | 2021-04-30 00:00:28.197301 | 2021-04-30 11:33:58.444979 | 0 | 0 | NULL | 0.00MB | 0.00MB | | 1 | 1 | 1002 | DOING | 1 | 12 | 2021-04-30 00:00:28.197301 | 2021-04-30 11:33:41.845543 | 0 | 0 | NULL | 0.00MB | 0.00MB | +-------------+-------------------+-----------+--------+----------------+-----------------+----------------------------+----------------------------+-------------+--------------+-------------------+---------------------+----------------------+ 3 rows in set (0.07 sec)View the information about the splitting of logs
obclient> SELECT * FROM CDB_OB_BACKUP_PIECE_FILES ; +-------------+-----------+----------+-----------------+---------+-------------+----------------------------+----------------------------+----------------------------+--------+-------------+------------+----------------+ | INCARNATION | TENANT_ID | ROUND_ID | BACKUP_PIECE_ID | COPY_ID | CREATE_DATE | START_TS | CHECKPOINT_TS | MAX_TS | STATUS | FILE_STATUS | COMPATIBLE | START_PIECE_ID | +-------------+-----------+----------+-----------------+---------+-------------+----------------------------+----------------------------+----------------------------+--------+-------------+------------+----------------+ | 1 | 1 | 1 | 1 | 0 | 20210430 | 2021-04-30 00:00:28.197301 | 2021-04-30 00:59:49.402568 | 2021-04-30 01:02:32.336195 | FROZEN | AVAILABLE | 1 | 1 | | 1 | 1 | 1 | 2 | 0 | 20210430 | 2021-04-30 01:02:32.336195 | 2021-04-30 02:01:38.260158 | 2021-04-30 02:04:10.990039 | ACTIVE | AVAILABLE | 1 | 1 | | 1 | 1001 | 1 | 1 | 0 | 20210430 | 2021-04-30 00:00:28.197301 | 2021-04-30 01:00:00.733364 | 2021-04-30 01:02:32.166782 | FROZEN | AVAILABLE | 1 | 1 | | 1 | 1001 | 1 | 2 | 0 | 20210430 | 2021-04-30 01:02:32.166782 | 2021-04-30 02:01:38.260158 | 2021-04-30 02:04:09.731651 | ACTIVE | AVAILABLE | 1 | 1 | +-------------+-----------+----------+-----------------+---------+-------------+----------------------------+----------------------------+----------------------------+--------+-------------+------------+----------------+