Exclude databases from backup

Hi,

I added an exclude regexp option but it failed. here is the error:

# innobackupex --user=root --password=123456 --tmpdir=/tmp --use-memory=4G --include='^(?!.*?de).*' /tmp 

xtrabackup: innodb_log_file_size = -4646917016675942400
xtrabackup: using O_DIRECT
xtrabackup: regcomp(^(?!.*?de).*) failed: Invalid preceding regular expression
innobackupex: Error: The xtrabackup child process has died at /tmp/innobackupex line 2579.

I wanted to exclude a database labeled “de”

How could I surround this issue?

Thanks in advance for your answers.

I don’t think --include option works to negate database/tables as this option works to include database/tables in backup. Other way around, you can use –tables-file option to list database tables in file which needs to backup… Something like follows:


$ mysql -e "SELECT CONCAT(table_schema,'.',table_name) FROM information_schema.tables WHERE table_schema IN ('db1',db2')" > db-tables.txt
$ innobackupex --tables-file=db-tables.txt /backup-dir/

This will backup only listed database tables in db-tables.txt file.

Thanks mirfan for your reply.

It’s regrettable that xtrabackup doesn’t accept negation in include, databases or tables options as it will be very useful and practical.