How to Restore a Backup & Migrate file using Drush
Hello folks.
Today I will share with you my experience restoring a Backup created with the module Backup & Migrate using drush.
0. Create your backup
You must use the Backup & Migrate module to genereate a new backup and copy it to your new instance where you plan to restore your backup.
1. Allocate the backup in the proper location.
One of the common problems is to put your backup file in the correct location , so that it can be recognized by Backup & Migrate Module.
Using Drush Interface you can determine the correct location.
First we need to check which are the available destinations.
#drush bam-destinations ID Name Operations manual Manual Backups Directory manual backup, restore, list files, configure, delete scheduled Scheduled Backups Directory scheduled backup, restore, list files, configure, delete download Download manual backup upload Upload restore db Default Database configure, source f273c00b06d3d6018151817d16c6b55b ftp.site.net scheduled backup, manual backup, restore, list files, configure, delete
For this example we will use manual destination, using Drush and SQL we will determine the exact location.
#drush sqlc mysql>select destination_id,name,type,location from backup_migrate_destinations; +----------------------------------+--------------------------+-------------+------------------------------------------------------+ | destination_id | name | type | location | +----------------------------------+--------------------------+-------------+------------------------------------------------------+ | f273c00b06d3d6018151817d16c6b55b | ftp.site.net | ftp | ftp://server.com:21/backup | | manual | Manual Backups Directory | file_manual | sites/www.site.com/files/backup_migrate/manual | +----------------------------------+--------------------------+-------------+------------------------------------------------------+
Off course the next step will be to copy our backup to sites/www.site.com/files/backup_migrate/manual, relative to our Drupal Installation.
2. Confirm our backup is available
After we had copied our backup, we need to confirm that our backup is now available to use as restore source.
#drush bam-backups manual Filename Date Age Size Domain-2012-03-22T09-36-03.mysql.gz Mar 22 2012 - 10:47am 1 min 4.83 MB
3. Restore the backup
Now we just need the request of restoring our backup.
#drush bam-restore db manual Domain-2012-03-22T09-36-03.mysql.gz ……. // A lot of sql messages Default Database restored from Manual Backups Directory file Domain-2012-03-22T09-36-03.mysql in 47394.37 ms. 23534 SQL commands executed. [success]
Enjoy It
enzo.







