10bet网址
MySQL Enterprise Backup 8.0 User's Guide
相关的文档10bet官方网站 Download this Manual

5.1.4 Table-Level Recovery (TLR)

For MySQL Enterprise Backup 8.0.20 and later:Table-Level Recovery (TLR) allows selected tables (or schemas) to be restored from a backup (be it a full backup, a partial backup, or a backup created usingtransportable tablespaces (TTS)) using the--include-tablesand--exclude-tablesoptions. The feature is also known aspartial restorein this manual. Here are some general requirements for performing a TLR or partial restore:

  • The destination server must be running.

  • The required parameters for connecting to the server (port number, socket name, etc.) are provided as command-line options formysqlbackup, or are specified in the[client]section of a defaults file.

  • The destination server must be using the same page size that was used on the server on which the backup was made.

  • Theinnodb_file_per_tableoption must be enabled on the destination server.

  • Fornon-TTS backups贝:表ng restored must already exist on the destination server, in the same table definition.

  • ForTTS backups贝:表ng restored mustnotalready exist on the destination server.

  • While it isnotnecessary to specify the--datadiroption when partially restoring a backup,ifthe option is specified, its value must match that of the target server, or the restore operation will fail (when restoring a TTS backup with release 8.0.16 or earlier, the--datadiroption is required).

Here are some limitations for a TLR or partial restore:

  • Individual partitions cannot be selectively restored. Tables selected by the--include-tablesand--exclude-tablesoptions are always restored in full.

  • Partial restores cannot be performed with incremental backups.

  • Binary, relay, and undo logs are not restored.

  • Fornon-TTS backupsonly,these additional limitations apply:

    • After partial restores, tables could contain changes from uncommitted transactions.

    • The auto-increment values of the restored tables for a partial restore might not be the same as they were at the end of the backup process.

    • Encrypted InnoDB tables cannot be included in a partial restore.

The following command restores the tablecatsin thepetsschema from the backup:

Example 5.7 Restoring A Selected Table from an Image Backup

mysqlbackup --socket=/tmp/restoreserver.sock --include-tables="^pets\.cats" --backup-dir=/dba/backuptmp \ --backup-image=/dba/my.mbi copy-back-and-apply-log

The following command restores all tables in thesalesdatabase from the backup, but excludes the table with the namehardware:

Example 5.8 Restoring Selected Tables in a Schema from an Image Backup

mysqlbackup --socket=/tmp/restoreserver.sock --include-tables="^sales\." \ --exclude-tables="^sales\.hardware$" --backup-dir=/dba/backuptmp --backup-image=/dba/my.mbi \ copy-back-and-apply-log

Also seeSection 5.1.5, “Restoring Backups Created with the--use-ttsOption”for additional information on partial restores using TTS backups.

Note

For MySQL Enterprise Backup 8.0.19 and before, partial restore is only supported forTTS backups.