Download MySQL Enterprise Backup User`s Guide (Version 3.11.1)
Transcript
Making a Partial Backup Each table is checked against the regular expression specified with the --include-tables or -exclude-tables option. If the regular expression matches the fully qualified name of the table (in the form of db_name.table_name), the table is included or excluded for the backup. The regular expression syntax used is the extended form specified in the POSIX 1003.2 standard. The options have been implemented with Henry Spencer's regular expression library. • Including some or all InnoDB tables, but not other table types. This uses the --only-innodb option. • Leaving out files that are present in the MySQL data directory but not actually part of the MySQL instance. This uses the --only-known-file-types option. • Achieving a multiple of selection effects by using a combination of the above mentioned options. • Backing up a selection of InnoDB tables using transportable tablespaces (TTS). This uses the --usetts and the --include-tables or --exclude-tables (or both) options. For syntax details on all the options involved, see Section 5.1.9, “Partial Backup and Restore Options”. Important Typically, a partial backup is more difficult to restore than a full backup, because the backup data might not include the necessary interrelated pieces to constitute a complete MySQL instance. In particular, InnoDB tables have internal IDs and other data values that can only be restored to the same instance, not a different MySQL server. Always fully test the recovery procedure for any partial backups to understand the relevant procedures and restrictions. Important Because the InnoDB system tablespace holds metadata about InnoDB tables from all databases in an instance, restoring a partial backup on a server that includes other databases could cause the system to lose track of those InnoDB tables in other databases. Always restore partial backups on a fresh MySQL server instance without any other InnoDB tables that you want to preserve. The following are some command samples for partial backups. Including all tables with names starting with “emp” into the backup: $ mysqlbackup \ --host=localhost --user=mysqluser --protocol=TCP --port=3306 \ --backup-dir=$MEB_BACKUPS_DIR/backupdir \ --include-tables='\.emp' \ backup Taking a backup of all tables except tables from the “mysql” and “performance_schema” databases: $ mysqlbackup \ --host=localhost --user=mysqluser --protocol=TCP --port=3306 \ --backup-dir=$MEB_BACKUPS_DIR/backupdir \ --exclude-tables='^(mysql|performance_schema)\.' \ backup Taking a backup of all tables in the “sales” database, but excludes the table with the name “hardware” $ mysqlbackup \ --host=localhost --user=mysqluser --protocol=TCP --port=3306 \ 37