Restoring Individual Tables and Partitions with Mariabackup

You are viewing an old version of this article. View the current version here.

When using Mariabackup, you don't necessarily need to restore every table and/or partition that was backed up. Even if you're starting from a full backup, it is certainly possible to restore only certain tables and/or partitions from the backup, as long as the table or partition involved is in an InnoDB file-per-table tablespace. This page documents how to restore individual tables and partitions.

Preparing the Backup

Before you can restore from a backup, you first need to prepare it to make the data files consistent. You can do so with the --prepare command option.

The ability to restore individual tables and partitions relies on InnoDB's transportable tablespaces. For MariaDB to import tablespaces like these, InnoDB looks for a file with a .cfg extension. For Mariabackup to create these files, you also need to add the --export option during the prepare step.

For example, you might execute the following command:

$ mariabackup --prepare --export \
   --target-dir=/var/mariadb/backup/ \
   --user backup_user --password backup_passwd

If this operation completes without error, then the backup is ready to be restored.

Restoring the Backup

The process that is used to restore the backup will depend on whether partitioning is involved.

Restoring Individual Non-Partitioned Tables

To restore individual non-partitioned tables from a backup, find the .ibd and .cfg files for the table in the backup, and then import them using the Importing Transportable Tablespaces for Non-partitioned Tables process.

Restoring Individual Partitions and Partitioned Tables

To restore individual partitions or partitioned tables from a backup, find the .ibd and .cfg files for the partition(s) in the backup, and then import them using the Importing Transportable Tablespaces for Partitioned Tables process.

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.