I have a large database (over 150GB and growing) in production. Currently I make a full back up of it using the mariabackup command, and then twice a day I do incremental backups of the database.
I need to make a development version of the database and would like to use the backup I already have for it. From the documentation I've found for the command it seems the restoration of it is straightforward but effectively replaces what is there. I can't see anything that allows me to change the name of the database and effectively create a new one from the backup. How is it possible?
Its slightly manual, but from partial backup and restore:
At the prepare stage use
--exportThen you need to have a
devdatabase with all the tables there with discarded tablespaces. Creating tables can be done withmariadb-dump --no-data prod | mariadb dev. Discarding tables spaces isALTER TABLE tablename DISCARD TABLESPACE. I haven't seen an easy automation for this. Will need ' SET SESSION foreign_key_checks=0;' if there are foreign key constraints on the table.Copy the tablespaces from the backup:
Then for all the tables:
Partitioned tables are more complicated.
Note for MariaDB-11.2, no
CREATE TABLEorDISCARD TABLESPACEis needed, however the.frmtable structure file should be copied.