Rechercher dans le manuel MySQL

13.3.5 LOCK INSTANCE FOR BACKUP and UNLOCK INSTANCE Syntax

  1. LOCK INSTANCE FOR BACKUP
  2.  
  3. UNLOCK INSTANCE

LOCK INSTANCE FOR BACKUP acquires an instance-level backup lock that permits DML during an online backup while preventing operations that could result in an inconsistent snapshot.

Executing the LOCK INSTANCE FOR BACKUP statement requires the BACKUP_ADMIN privilege. The BACKUP_ADMIN privilege is automatically granted to users with the RELOAD privilege when performing an in-place upgrade to MySQL 8.0 from an earlier version.

Multiple sessions can hold a backup lock simultaneously.

UNLOCK INSTANCE releases a backup lock held by the current session. A backup lock held by a session is also released if the session is terminated.

LOCK INSTANCE FOR BACKUP prevents files from being created, renamed, or removed. REPAIR TABLE TRUNCATE TABLE, OPTIMIZE TABLE, and account management statements are blocked. See Section 13.7.1, “Account Management Statements”. Operations that modify InnoDB files that are not recorded in the InnoDB redo log are also blocked.

LOCK INSTANCE FOR BACKUP permits DDL operations that only affect user-created temporary tables. In effect, files that belong to user-created temporary tables can be created, renamed, or removed while a backup lock is held. Creation of binary log files is also permitted.

A backup lock acquired by LOCK INSTANCE FOR BACKUP is independent of transactional locks and locks taken by FLUSH TABLES tbl_name [, tbl_name] ... WITH READ LOCK, and the following sequences of statements are permitted:

  1. LOCK INSTANCE FOR BACKUP;
  2. FLUSH TABLES tbl_name [, tbl_name] ... WITH READ LOCK;
  3. UNLOCK TABLES;
  4. UNLOCK INSTANCE;
  1. FLUSH TABLES tbl_name [, tbl_name] ... WITH READ LOCK;
  2. LOCK INSTANCE FOR BACKUP;
  3. UNLOCK INSTANCE;
  4. UNLOCK TABLES;

The lock_wait_timeout setting defines the amount of time that a LOCK INSTANCE FOR BACKUP statement waits to acquire a lock before giving up.


Find a PHP function

Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-lock-instance-for-backup.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:en Manuel MySQL : https://dev.mysql.com/

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut