LOCK INSTANCE FOR BACKUP 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.LOCK INSTANCE FOR BACKUP
获取实例级备份锁,该锁允许在联机备份期间使用DML,同时防止可能导致快照不一致的操作。
Executing the 执行LOCK INSTANCE FOR BACKUP
statement requires the BACKUP_ADMIN
privilege. LOCK INSTANCE FOR BACKUP
语句需要BACKUP_ADMIN
权限。The 当执行从早期版本到MySQL 8.0的就地升级时,具有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.RELOAD
权限的用户将自动获得BACKUP_ADMIN
权限。
Multiple sessions can hold a backup lock simultaneously.多个会话可以同时持有备份锁。
UNLOCK INSTANCE
releases a backup lock held by the current session. UNLOCK INSTANCE
释放当前会话持有的备份锁。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. LOCK INSTANCE FOR BACKUP
防止创建、重命名或删除文件。REPAIR TABLE
TRUNCATE TABLE
, OPTIMIZE TABLE
, and account management statements are blocked. REPAIR TABLE
、TRUNCATE TABLE
、OPTIMIZE TABLE
和帐户管理报表被阻止。See Section 13.7.1, “Account Management Statements”. 请参阅第13.7.1节,“账户管理语句”。Operations that modify 修改未记录在InnoDB
files that are not recorded in the InnoDB
redo log are also blocked.InnoDB
重做日志中的InnoDB
文件的操作也会被阻止。
LOCK INSTANCE FOR BACKUP
permits DDL operations that only affect user-created temporary tables. LOCK INSTANCE FOR BACKUP
允许仅影响用户创建的临时表的DDL操作。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
, and the following sequences of statements are permitted:tbl_name
[, tbl_name
] ... WITH READ LOCKLOCK INSTANCE FOR BACKUP
获取的备份锁独立于事务锁和FLUSH TABLES
所使用的锁,并且允许以下语句序列:tbl_name
[, tbl_name
] ... WITH READ LOCK
LOCK INSTANCE FOR BACKUP; FLUSH TABLEStbl_name
[,tbl_name
] ... WITH READ LOCK; UNLOCK TABLES; UNLOCK INSTANCE;
FLUSH TABLEStbl_name
[,tbl_name
] ... WITH READ LOCK; LOCK INSTANCE FOR BACKUP; UNLOCK INSTANCE; 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.lock_wait_timeout
设置定义LOCK INSTANCE FOR BACKUP
语句在放弃前等待获取锁的时间量。