This topic describes how to initiate a secondary log backup in two scenarios based on whether the log splitting feature is enabled to split log backups into pieces.
Secondary log backup when log splitting is enabled
In physical backup and restore, the content of the backup directory can be split. To resolve the problem of insufficient capacity on the backup storage media, you can perform a secondary log backup on the split content.
Perform a secondary backup on a single backup directory
To perform a secondary backup on a single backup directory, you can specify a backup_piece to back up. To archive the secondary backup to a destination that differs from the one specified for backup_backup_dest, you can specify another destination in the secondary backup statement.
Execute the following statement to perform a secondary backup on a single backup directory:
obclient> ALTER SYSTEM BACKUP BACKUPPIECE [=N] [backup_backup_dest = uri];
In the statement:
Nspecifies thepiece_idof the log backup to be backed up.[backup_backup_dest = uri]specifies the destination for the secondary backup. OSS and NFS can be used as the backup media.If
backup_backup_desthas been set before secondary backup, you can disregard this parameter. Log backup data is archived to the directory specified inbackup_backup_destby default.If
backup_backup_destis not set before secondary backup, this parameter must be specified.For more information about the configuration method and description of
backup_backup_dest, see Preparations for secondary backup.
For example:
- Back up the log backup whose
piece_idis1to thefile:///data/nfs/backup_backupdirectory.
obclient> ALTER SYSTEM BACKUP BACKUPPIECE 1 backup_backup_dest = 'file:///data/nfs/backup_backup';
Perform a secondary backup on multiple backup directories
Execute the following statements to perform a secondary backup on multiple backup directories:
- Perform a secondary backup on all directories or specified directories in the
backup piece.
obclient> ALTER SYSTEM BACKUP BACKUPPIECE ALL [backup_backup_dest = 'xxxxx'];
obclient> ALTER SYSTEM BACKUP BACKUPPIECE ALL NOT BACKED UP N TIMES backup_backup_dest = 'xxxxx';
In the statements:
ALLindicates that allbackup_set_idandpiece_iddirectories whosefile_statusisAVAILABLEwill be included in the secondary backup.Note
You can view the
file statusin theCDB_OB_BACKUP_PIECE_FILESview.The
NOT BACKED UP N TIMESparameter indicates that data that has been backed up N times will not be included in the secondary backup.Nindicates the number of times.If the
NOT BACKED UP N TIMESparameter is specified in the command, thebackup_backup_destparameter must also be specified. Otherwise, thebackup_backup_destparameter does not need to be specified, and the backup data is archived to the directory specified by thebackup_backup_destparameter by default.
Secondary log backup when log splitting is not enabled
During a secondary log backup in which log splitting is not enabled, the system saves logs from the source backup location to the destination backup location.
Log on to the
systenant as therootuser.Set the
log_archive_checkpoint_intervalparameter forbackup_backup_dest_optionto set the interval of the working thread for the secondary backup.The
backup_backup_dest_optionparameter specifies parameters related to secondary backup, and thelog_archive_checkpoint_intervalparameter specifies the interval for performing secondary log backup operations.For example, you can set
log_archive_checkpoint_intervalto two hours to perform a secondary log backup every two hours.For more information about the
log_archive_piece_switch_intervalparameter forbackup_backup_dest_option, see Preparations for secondary backup.For more information about
backup_backup_dest_option, see backup_backup_dest_option.Start the worker thread for secondary log backup.
obclient> ALTER SYSTEM START BACKUP ARCHIVELOG;Note
After the worker thread is started, you can execute the
ALTER SYSTEM STOP BACKUP ARCHIVELOG;statement to stop it.