I’m a newbie and practice in Percona xtrabackup tools
I try backup database by
innobackupex --defaults-file=/etc/my.cnf --user=bkpuser --password=s3cret --database=“mydatabase” /home/mysql/Backup/
status completed.
innobackupex --apply-log --export /home/mysql/Backup/2014-09-24_12-23-19
status completed
I try to restore but got error message.
innobackupex --copy-back /home/mysql/Backup/2014-09-24_12-23-19
innobackupex: Error: Original data directory ‘/database/data’ is not empty! at /usr/local/xtrabackup/bin/innobackupex line 2162.
Note: in /database/data have more than one databases are running.
How can I restore database??? I want to restore only one database.
Apply log with --export option. This will create prepare each table with .exp and .ibd files.
2) innobackupex --apply-log --export /path/to/backup/
On importing server create tables manually which need to restore
3) CREATE TABLE test …
Discard the tablespace
4) ALTER TABLE test DISCARD TABLESPACE;
Copy the .exp & .ibd files to the datadir where need to import
5) ALTER TABLE test IMPORT TABLESPACE;
It’s mandatory that your source server from where you taking the backup have innodb_file_per_table option enabled and the importing server should have innodb_file_per_table and innodb_expand_import enabled (only supported for Percona Server). You can read more about it here [url]Percona XtraBackup
Does the 2nd invocation of innobackupex with --apply-log --export have to be done at the time of the backup ? Or can it be done when the backup needs to be restored ?
Using the full path (including the date) is not very handy to aoutomate when doing backups.