For an overview of incremental backups and usage examples for these options, see Section 4.3.3, “Making a Differential or Incremental Backup” and Section 5.1.3, “Restoring an Incremental Backup”.
To take an incremental backup, specify the
--incremental or
--incremental-with-redo-log-only,
along with the --backup-dir option.
Depending on whether --incremental
or --incremental-with-redo-log-only
is used, other options are required or recommended. All InnoDB
data modified after the LSN
(specified directly or indirectly by the options you use) is
copied into the incremental backup. To restore an incremental
backup, specify the --incremental
and the --backup-dir option.
--incremental[={full-scan|optimistic}]Command-Line Format --incrementalType Enumeration Default Value full-scanValid Values page-trackfull-scanoptimisticSpecifies that the associated
backup,backup-to-image,copy-back-and-apply-log, orcopy-backoperation is incremental. When performing an incremental backup, there are two possible values for this option:full-scan: mysqlbackup scans all InnoDB data files in the server's data directory to find pages that have been changed since the last backup and saves them.optimistic: mysqlbackup only scans for changed pages in the InnoDB data files that have been modified since the last backup and then saves them. In general, optimistic incremental backups are faster than full-scan ones when not many tables in the database have been modified; however a few restrictions apply to this feature. See Full-scan versus Optimistic Incremental Backup for details.
Default:
full-scan. The value for the option have no meaning when the option is used for restoring an incremental backup.During a backup, the option also requires the use of either the
--incremental-baseoption or the--start-lsnoption. Only InnoDB tables are backed up incrementally. By default, all non-InnoDB and.frmfiles are included into the incremental backup and in their fullness. To exclude non-InnoDB data in an incremental backup, use the--only-innodboption.
--incremental-with-redo-log-onlySpecifies that an incremental backup is to be created using only the redo log. This alternate type of incremental backup has different performance characteristics and operational limitations compared to backups created with the
--incrementaloption; see Creating Incremental Backups Using Only the Redo Log for a discussion on their differences.To use this option, you also need to specify the
--incremental-baseoption or the--start-lsnoption. Just like with the--incrementaloption, only InnoDB tables are backed up incrementally. By default, all non-InnoDB and.frmfiles are included into the incremental backup and in their fullness. To exclude non-InnoDB data in an incremental backup, use the--only-innodboption.
--incremental-base=mode:argumentCommand-Line Format --incremental-base=mode:argumentType String With this option, the mysqlbackup retrieves the information needed to perform incremental backups from the metadata inside the backup directory rather than from the
--start-lsnoption. It saves you from having to specify an ever-changing, unpredictable LSN value when doing a succession of incremental backups. Instead, you specify a way to locate the previous backup directory through the combination ofmodeandargumentin the option syntax. The alternatives are:dir:directory_pathYou specify the prefix
dir:followed by a directory path. The path argument points to the directory where the data from the previous backup is stored. With the first incremental backup, you specify the directory holding the full backup; with the second incremental backup, you specify the directory holding the first incremental backup, and so on.history:{last_backup | last_full_backup}The prefix
history:followed by one of the two possible values:last_backup: This makes mysqlbackup query theend_lsnvalue from the last successful non-TTS backup as recorded in thebackup_historytable of the server instance that is being backed up.last_full_backup: (For MySQL Enterprise Backup 4.1.5 and later) This works similarly as the valuelast_backup, except that it makes mysqlbackup look for the last full backup that was taken and use it as the base backup, thus creating a differential backup.
NoteIf the last full or partial backup made was a TTS backup, mysqlbackup skips it, and keeps searching the backup history until it finds the last non-TTS backup and then returns its
end_lsnvalue.WarningDo not use the
history:mode if the previous backup was a full backup taken with the--no-connectionoption, which always turns off the recording of backup history and might cause errors for a subsequent incremental backup using this mode of the--incremental-baseoption.
--start-lsn=LSNCommand-Line Format --start-lsn=LSNType Numeric In an incremental backup, specifies the highest LSN value included in a previous backup. You can get this value from the output of the previous backup operation, or from the
backup_historytable'send_lsncolumn for the previous backup operation. Always used in combination with the--incrementaloption; not needed when you use the--incremental-baseoption; not recommended when you use the--incremental-with-redo-log-onlymechanism for incremental backups.NoteNo binary log files are copied into the incremental backup if the
--start-lsnoption is used. To include binary log files for the period covered by the incremental backup, instead of--start-lsn, use the--incremental-baseoption, which provides the necessary information for mysqlbackup to ensure that no gap exists between binary log data included in the previous backup and the current incremental backup.
--incremental-backup-dir=PATHAdvanced: Specifies the location for data of an incremental directory backup. When creating or restoring an incremental directory backup, the option serves the same function as
--backup-dirdoes for backups and restores in general, and the option can in fact be used interchangeably with--backup-dirfor directory backups. See the description for--backup-dirfor details.For an
apply-incremental-backupoperation, the option specifies the incremental backup directory whose data is used to update a directory backup specified by the--backup-diroption.NoteDo not use this option with any operations for image backups, for which the option has no meaning.