OceanBase Database supports 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 copy the split log backups in a secondary backup operation.
This topic shows you how to configure the log_archive_piece_switch_interval parameter for backup_dest_option to enable or disable backup based on log splitting in OceanBase Database.
Enable log splitting
Log on to the
systenant as therootuser.Enable backup based on log splitting by specifying the
log_archive_piece_switch_intervalparameter forbackup_dest_option.The
log_archive_piece_switch_intervalparameter specifies whether to automatically split the log file directory into multiple directories based on a specific interval. Value range: [1d, 7d]. Default value:0, which specifies not to perform log splitting.If you set
log_archive_piece_switch_intervalto 1d, log backups are split into pieces with an interval of one day, which means that the system automatically splits the next log piece after 24 hours from the current time. Due to factors such as the scheduling of log archiving threads, the next splitting may be delayed.For more information about the
log_archive_piece_switch_intervalparameter forbackup_dest_option, see Preparations for backup.For more information about the
backup_dest_optionparameter, see backup_dest_option.After you enable backup based on log splitting, you can view the progress of a log backup and information about the splitting of logs.
View the progress of the log backup.
For example:
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 setFor more information about fields in CDB_OB_BACKUP_ARCHIVELOG, see CDB_OB_BACKUP_ARCHIVELOG.
View information about the splitting of logs.
For example:
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 | +-------------+-----------+----------+-----------------+---------+-------------+----------------------------+----------------------------+----------------------------+--------+-------------+------------+----------------+ 4 rows in setFor more information about fields in CDB_OB_BACKUP_PIECE_FILES, see CDB_OB_BACKUP_PIECE_FILES.