Restoring a database backup

There is a number of ways to import a database backup, but we've found the quickest method is to decompress the two files and import using mage-dbump.sh

Compression format

The backups are stored in bzip2 compressed format (for space efficiency). Decompressing this file type can be done with either of 2 utilities, bzip2 or pbzip2. The traditional bzip2 application only uses a single core (and is slower) than pbzip2 which is multi-threaded.

Running the restore

First, copy and decompress the backups from the read-only backup partition, and write it to var/db.sql

cd /microcloud/domains/example/domains/example.com/http
pbzip2 -dc /microcloud/backups_ro/mysql/2013-09-04/06\:00\:01/example_magliv/2013-09-04T06\:00\:01_example_magliv_structure.sql.bz2 > var/db.sql
pbzip2 -dc /microcloud/backups_ro/mysql/2013-09-04/06\:00\:01/example_magliv/2013-09-04T06\:00\:01_example_magliv_data.sql.bz2 >> var/db.sql

Magento 1

Then download mage-dbdump.sh and restore the backup

wget -O mage-dbdump.sh sys.sonassi.com/mage-dbdump.sh
chmod +x mage-dbdump.sh
./mage-dbdump.sh –r
Magento 2

Then download mage2-dbdump.sh and restore the backup

wget -O mage2-dbdump.sh sys.sonassi.com/mage2-dbdump.sh
chmod +x mage2-dbdump.sh
./mage2-dbdump.sh –r