I have a live and a development version of a Drupal 7 site. I want to keep them as close in content as possible so I am using the Backup and Migrate module to take a backup of the live site and restore it onto the development site. This works fine until I clear the cache on the development site after the restore and things like views, menu items and entity forms disappear for some reason. They work fine after the restore up until I clear the cache.

Anybody have any idea what's going on?

I'm using the features module if that makes any difference.

  • Are the features that disappear still present on the site you're migrating from after your clear its cache (i.e. when you clear its cache to prepare for creating a backup)? Apr 21, 2014 at 12:24

2 Answers 2


Sorry, but your approach is wrong.

If things gets to disappear after cache clear, you have some serious bug in your implementation.

  1. You should exclude all cache tables from migration.

  2. After migration, you should clear cache of recipient site.

If your procedure is different, it's buggy. Details may vary but these two points are pretty much needed for consistent workflow.

If one of your sites generates different menu than the other after cache clear, then you failed to migrate some files that provide hook_menu or hook_menu_alter, or you have a problem with migrating menu data in database. Either way, disable cache for migration, don't ever try to rely on migrated cache.

  • True. I use Dackup and Migrate all the time to synchronize the db's, have been for years. Cache tables need to in included, but data from them - excluded from import. Apr 18, 2014 at 13:25
  • @AlexeiRayu, it actually works just as well to exclude them altogether (they're automatically recreated when needed). I have done it that way for years. Apr 18, 2014 at 14:53
  • @FreeRadical, huh, interesting! I never actually tried to exclude them altogether, good to know! :) Apr 19, 2014 at 7:49
  • My process is this: 1. Clear cache on Site B 2. Take backup of Site B using default profile which excludes cache tables, session, etc 3. Clear cache of Site A 4. Restore backup from Site B on Site A 5. All features of Site B now present on Site A 6. Clear cache of Site A, some features of both Site B and Site A now missing
    – nexus_6
    Apr 21, 2014 at 11:30
  • If features of site B is missing after step 6, they will also be missing after step 1. At this point, you should stop and wonder what is wrong with site B. Apr 21, 2014 at 12:19

Caches don't go well with the Backup and Migrate module. You should never migrate any cached material (it bloats the size of the dump and create all sorts of stability problems).

Before migrating, you should clear all caches on the site you migrate just to make sure your site is stable and all features still present after its cache is cleared.

Check the site after clearing the cache. If there are features missing, your site is broken and your problem is with the site, not with whatever method you use for migration.

Fortunately, Backup and Migrate lets you create profiles where you can exclude certain tables from the dump. You should always exclude any tables starting with cache*, but there a number of other tables you'd better off excluding to avoid state mismatches when you roll your backup back in again.

Also: Always make sure your site is in maintenance mode when making a backup, and when you roll your backup back.

Here is a list of tables I recommed excluding from the backup, with a brief explanation about what information the table holds:

  • {batch} – disconnect user from his/her batch, so make sure site is in maintenance mode;
  • {cache*} – the cache just optimises page loads, always safe to exclude;
  • {sessions} – loses user sessions, so make sure site is in maintenance mode;

In addition, excluding the following tables from only delete information that can simply be regenerated, so you may want to exclude to keep the size of the backup down:

  • {flood} – flood log generated by built-in flood control;
  • {search*} – loses search indices and statistics, indices is regenerated by cron;
  • {watchdog} – loses log messages.

To exclude these tables, navigate to Configuration → System → Backup and Migrate → Profiles. Click on Add profile, and give the profile a name so you can recognise it. Then under Default database backup options, select the tables you don't want included in the backup from the menu as show below.

enter image description here

  • I'll give that a go, but the default profile (which I have been using) appears to already do most of, if not all, of that. I also made sure to clear the cache before taking a backup. What I don't understand is that clearing the cache after restoring not only removes restored features, but features that were present before and after restoring the backup.
    – nexus_6
    Apr 21, 2014 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.