Last active
November 20, 2015 15:10
-
-
Save bordeo/11c6828ffe0113736578 to your computer and use it in GitHub Desktop.
Mysql Dump for magento exluding data for index, log, report
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
USER=$1 | |
PASS=$2 | |
DB=$3 | |
if [ -z $DB ]; | |
then | |
echo "\n" | |
echo "Usage: mysqldump-magento.sh user password database\n" | |
echo "You must specify the user pass and database name\n" | |
exit 1 | |
fi | |
mysqldump \ | |
--skip-tz-utc \ | |
--ignore-table=$DB.adminnotification_inbox \ | |
--ignore-table=$DB.aw_core_logger \ | |
--ignore-table=$DB.dataflow_batch_export \ | |
--ignore-table=$DB.dataflow_batch_import \ | |
--ignore-table=$DB.log_customer \ | |
--ignore-table=$DB.log_quote \ | |
--ignore-table=$DB.log_summary \ | |
--ignore-table=$DB.log_summary_type \ | |
--ignore-table=$DB.log_url \ | |
--ignore-table=$DB.log_url_info \ | |
--ignore-table=$DB.log_visitor \ | |
--ignore-table=$DB.log_visitor_info \ | |
--ignore-table=$DB.log_visitor_online \ | |
--ignore-table=$DB.index_event \ | |
--ignore-table=$DB.report_event \ | |
--ignore-table=$DB.report_viewed_product_index \ | |
--ignore-table=$DB.report_compared_product_index \ | |
--ignore-table=$DB.catalog_compare_item \ | |
--ignore-table=$DB.catalogindex_aggregation \ | |
--ignore-table=$DB.catalogindex_aggregation_tag \ | |
--ignore-table=$DB.catalogindex_aggregation_to_tag \ | |
-u$USER \ | |
-p$PASS \ | |
-hlocalhost $DB | gzip > $DB_dump.sql.gz \ | |
&& mysqldump \ | |
--skip-tz-utc \ | |
adminnotification_inbox \ | |
aw_core_logger \ | |
dataflow_batch_export \ | |
dataflow_batch_import \ | |
log_customer \ | |
log_quote \ | |
log_summary \ | |
log_summary_type \ | |
log_url \ | |
log_url_info \ | |
log_visitor \ | |
log_visitor_info \ | |
log_visitor_online \ | |
index_event \ | |
report_event \ | |
report_viewed_product_index \ | |
report_compared_product_index \ | |
catalog_compare_item \ | |
catalogindex_aggregation \ | |
catalogindex_aggregation_tag \ | |
catalogindex_aggregation_to_tag \ | |
-u$USER \ | |
-p$PASS \ | |
-hlocalhost -d $DB | gzip >> $DB_dump.sql.gz \ | |
if [ ${PIPESTATUS[0]} -ne "0" ]; | |
then | |
echo "\"mysqldump\" failed with Error"; | |
exit 1; | |
else | |
echo "Database dump successfully!"; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment