Magento code and database backup

There are times when MagePhobia developers need code and DB dumps from our client to perform investigation on an issue. Below are the commands we use to create those dumps. DB dump command would save up about 50% of DB dump space vs. the space of dump taken via default mysqldump. The key here is to avoid dumping temporary tables and data:

For Enterprise:
( nice -n 15 mysqldump -u{db_user} -h{db_host} -p {database_name} --single-transaction --opt --skip-lock-tables --ignore-table='{database_name}'.'log_customer' --ignore-table='{database_name}'.'log_quote' --ignore-table='{database_name}'.'log_summary' --ignore-table='{database_name}'.'log_summary_type' --ignore-table='{database_name}'.'log_url' --ignore-table='{database_name}'.'log_url_info' --ignore-table='{database_name}'.'log_visitor' --ignore-table='{database_name}'.'log_visitor_info' --ignore-table='{database_name}'.'log_visitor_online' --ignore-table='{database_name}'.'enterprise_logging_event' --ignore-table='{database_name}'.'enterprise_logging_event_changes' --ignore-table='{database_name}'.'index_event' --ignore-table='{database_name}'.'index_process_event' --ignore-table='{database_name}'.'report_event' --ignore-table='{database_name}'.'report_viewed_product_index' --ignore-table='{database_name}'.'dataflow_batch_export' --ignore-table='{database_name}'.'dataflow_batch_import' --ignore-table='{database_name}'.'core_cache' --ignore-table='{database_name}'.'core_cache_tag' ; nice -n 15 mysqldump --no-data -u{db_user} -h{db_host} -p {database_name} --single-transaction --opt --skip-lock-tables log_customer log_quote log_summary log_summary_type log_url log_url_info log_visitor log_visitor_info log_visitor_online enterprise_logging_event enterprise_logging_event_changes index_event index_process_event report_event report_viewed_product_index dataflow_batch_export dataflow_batch_import core_cache core_cache_tag ) | nice -n 15 gzip > {dump_location}/db_dump.sql.gz
For Community:
( nice -n 15 mysqldump -u{db_user} -h{db_host} -p {database_name} --single-transaction --opt --skip-lock-tables --ignore-table='{database_name}'.'log_customer' --ignore-table='{database_name}'.'log_quote' --ignore-table='{database_name}'.'log_summary' --ignore-table='{database_name}'.'log_summary_type' --ignore-table='{database_name}'.'log_url' --ignore-table='{database_name}'.'log_url_info' --ignore-table='{database_name}'.'log_visitor' --ignore-table='{database_name}'.'log_visitor_info' --ignore-table='{database_name}'.'log_visitor_online' --ignore-table='{database_name}'.'index_event' --ignore-table='{database_name}'.'index_process_event' --ignore-table='{database_name}'.'report_event' --ignore-table='{database_name}'.'report_viewed_product_index' --ignore-table='{database_name}'.'dataflow_batch_export' --ignore-table='{database_name}'.'dataflow_batch_import' --ignore-table='{database_name}'.'core_cache' --ignore-table='{database_name}'.'core_cache_tag' ; nice -n 15 mysqldump --no-data -u{db_user} -h{db_host} -p {database_name} --single-transaction --opt --skip-lock-tables log_customer log_quote log_summary log_summary_type log_url log_url_info log_visitor log_visitor_info log_visitor_online index_event index_process_event report_event report_viewed_product_index dataflow_batch_export dataflow_batch_import core_cache core_cache_tag ) | nice -n 15 gzip > {dump_location}/db_dump.sql.gz
The above commands automatically archive DB dump created 'on the fly'.

The main beauty about above commands is that '--single-transaction --opt --skip-lock-tables' will not lock the database for the time of the DB dump creation.

For the code archive we use
tar cvzf archive.tar.gz --exclude=var --exclude=media *
being in Magento root folder.

Cheers!

We Love Our Customers

    Team of US based Certified Magento Engineers will work directly with you (no middle-men) to make sure MagePhobia provides best quality technical services. Some of our Magento Engineers are ex-Magento employees who built Magento for several years and know Magento inside-out.
    MagePhobia provides affordable
Magento Services with one of the best quality on the market.
    Our US based Technical Support is provided exclusively by our Certified Magento Developers and System Administrators, and is available 24/7 via ticketing, chat, and phone.
    MagePhobia offers short and long-term contracts as well as 'per job' basis contracts. We refund in case of unsatisfactory results which, we believe, will not occur ever.

We are all-in for customer satisfaction!