It's better to trim the big database on dump by using drush sql-dump
to dump the SQL file. This gives you the advantage to specify the additional options to skip the specific tables when dumping (such as cache or migrate tables).
This can be either specified in the command line (see: drush help sql-dump
) or configure it in your drushrc file as shown in example.drushrc.php
like:
$options['structure-tables']['common'] = array('cache', 'cache_*', 'history', 'search_*', 'sessions', 'watchdog');
$options['skip-tables']['common'] = array('migration_*');
or per host basis like if you're using sql-sync
or sql-dump
between remotes:
$aliases['global'] = array(
// These options will only be set if the alias is used with the specified command.
'command-specific' => array(
'sql-sync' => array(
'structure-tables-key' => 'common',
'skip-tables-key' => 'common',
'structure-tables' => array(
// You can add more tables which contain data to be ignored by the database dump
'common' => array('cache', 'cache_*', 'history', 'search_*', 'sessions', 'watchdog'),
),
'skip-tables' => array(
'common' =>array('migration_*'),
),
),
'sql-dump' => array(
'ordered-dump' => FALSE,
'structure-tables-key' => 'common',
'skip-tables-key' => 'common',
),
), // end: command-specific
);
Then you can load this settings into your host via:
$aliases['stage'] = array(
// ...
) + $aliases['global'];
Then you can try something like:
drush @source sql-dump | drush @self sql-cli
To monitor the progress, you can add pipe viewer (pv
) in between (like ... | pv | ...
).
See also: