Solved

mysqldump --single-transaction for online backup

Posted on 2014-09-16
7
965 Views
Last Modified: 2014-09-23
Hi experts,

I found the option --single-transaction for mysqldump.
Some forums tell, that using this option, a database can be backed up without locking tables.
How would this work? Why should we use Percona xtrabackup for online database backups if we could simply use mysqldump with --singe-transaction?

I have in mind that mysqldump is not a tool for online backup?
Can you confirm that?

If we use --single-transaction on a production database. Would this be OK?

IT is the goal the have a complete database-backup without interfering the qpplication, which uses the database.

Many thanks in advance!
Roland
0
Comment
Question by:Systemadministration
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 23

Expert Comment

by:nemws1
ID: 40325545
Sure.  --single-transaction was added specifically for production databases.  It takes advantage of the transactional capabilities of InnoDB to backup a consistent state without locking the tables.

Note - it *only* works on InnoDB tables.  MyISAM/HEAP tables will be backed up without issuing any table locks and may result in inconsistent data!

I would recommend using --single-transaction for your InnoDB tables and to do a locked table backup for your non-InnoDB tables.
0
 

Author Comment

by:Systemadministration
ID: 40325620
We only have InnoDB at the Moment.
But is there a maximum size of database while using single-transaction or mysqldump in general?
0
 
LVL 23

Accepted Solution

by:
nemws1 earned 500 total points
ID: 40325645
No, no max for InnoDB and single-trans.  It more depends on how many transactions are going on while the database is being backed up.  The server will slow down while the backup is running because any write transactions are spooled to the binary log and *not* written out to disk (as you're backing up what is on disk).  So, if you have a *lot* of transaction against your DB while you are backing it up, those will slow down.  If you have a really big database that takes a long while to back up, this might be a performance issue.

You should hopefully already be backing up your database during a "dead" time (8pm, 2pm, or whatever) so it really shouldn't be an issue.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Systemadministration
ID: 40327366
OK, but you mean the InnoDB internal Binary-Logging, not the MySQL Binary-Log.
Because MySQL Binary Log is not active.
0
 
LVL 23

Expert Comment

by:nemws1
ID: 40328102
Yup.  InnoDB binary log.
0
 

Author Comment

by:Systemadministration
ID: 40338484
OK, till now we used following:

mysqldump --opt -Q [dbname] -u xxx -p > test.sql

I read that --opt and -Q ist Standard. Can I use mysqldump as follows to get consistent dupms:

mysqldump --single-transaction --quick [dbname] -u xxx -p > test.sql


Thanks a lot!
0
 
LVL 23

Expert Comment

by:nemws1
ID: 40340206
Yes, that looks good to me.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Showing random records from database 10 47
Hyper V Cluster/Storage Question 5 73
Win 10...Some user folders missing location tab 7 138
MYSQL responding very slow 3 48
Are you looking to recover an email message or a contact you just deleted mistakenly? Or you are searching for a contact that you erased from your MS Outlook ‘Contacts’ folder and now realized that it was important.
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question