# Does Percona XtraBackup lock the database during the backup?

**URL:** <https://forums.percona.com/t/does-percona-xtrabackup-lock-the-database-during-the-backup/2646>\
**Category:** Percona XtraBackup\
**Created:** [April 24, 2013, 7:47pm UTC](https://forums.percona.com/t/does-percona-xtrabackup-lock-the-database-during-the-backup/2646 "2013-04-24T19:47:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidjhp](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@davidjhp](https://forums.percona.com/u/davidjhp)\
**Post date:** [April 24, 2013, 7:47pm UTC](https://forums.percona.com/t/does-percona-xtrabackup-lock-the-database-during-the-backup/2646/1 "2013-04-24T19:47:00Z")

</div>

The Percona XtraBackup Documentation, Release 2.0.6 states:

Percona XtraBackup is a hot backup utility that does not lock your database during the backup.

However the documentation also states that it will execute “FLUSH TABLES WITH READ LOCK.” That certainly will lock the database.

Arent these statements contradictory? I need to know if Percona XtraBackup will lock tables during backup? If yes, then I wouldnt be able to use this in production.

Our database consists only of InnoDB tables.

---

<div class="post-metadata">

**Author:** ![revin](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/revin/32/824_2.png) [@revin](https://forums.percona.com/u/revin)\
**Post date:** [April 24, 2013, 11:36pm UTC](https://forums.percona.com/t/does-percona-xtrabackup-lock-the-database-during-the-backup/2646/2 "2013-04-24T23:36:55Z")

</div>

> [@davidjhp;9845](#):
>
> The Percona XtraBackup Documentation, Release 2.0.6 states: Percona XtraBackup is a hot backup utility that does not lock your database during the backup. However the documentation also states that it will execute “FLUSH TABLES WITH READ LOCK.” That certainly will lock the database. Arent these statements contradictory? I need to know if Percona XtraBackup will lock tables during backup? If yes, then I wouldnt be able to use this in production. Our database consists only of InnoDB tables.

David,

FTWRL is only needed to copy other files like \*.FRM or MYI/MYD files if you have MyISAM. Because you cannot take a consistent snapshot of tables other than InnoDB without FTWRL this is often necessary.

On the other hand, if you are absolutely sure of 2 things 1) No DDL occurs on the tables being backed up at the time 2) You only have InnoDB tables aside from the mysql schema, and if you do have MyISAM (nothing will ever write to it during backup), you can use the --no-lock option with innobackupex to avoid the FTWRL.

So these are not necessarily contradicting statements 🙂

---

<div class="post-metadata">

**Author:** ![r4z0r](https://avatars.discourse-cdn.com/v4/letter/r/3da27b/32.png) [@r4z0r](https://forums.percona.com/u/r4z0r)\
**Post date:** [September 13, 2013, 1:27pm UTC](https://forums.percona.com/t/does-percona-xtrabackup-lock-the-database-during-the-backup/2646/3 "2013-09-13T13:27:00Z")

</div>

> [@revin;9846](#):
>
> 1. No DDL occurs on the tables being backed up at the time 2) You only have InnoDB tables aside from the mysql schema, and if you do have MyISAM (nothing will ever write to it during backup)

​When do these restrictions apply? During the whole backup process or just the time when the non-innodb tables are being copied?

---

<div class="post-metadata">

**Author:** ![mirfan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/mirfan/32/16890_2.png) [@mirfan](https://forums.percona.com/u/mirfan)\
**Post date:** [September 15, 2013, 2:57pm UTC](https://forums.percona.com/t/does-percona-xtrabackup-lock-the-database-during-the-backup/2646/4 "2013-09-15T14:57:01Z")

</div>

This applies for .frm files and for non-innodb tables.
