mysqldump 参数--single-transaction
其实很简单,single-transaction可以让mysqldump 的时候不锁表。但是他有3个前提
- innodb的引擎
- 不能在执行的同时,有其他alter table ,drop table,rename table,truncate table的操作。
- 隔离级别 必须是REPEATABLE READ ,很多公司都会修改这个隔离级别的,比如阿里云的rds ,默认隔离级别是READ-COMMITTED
下面附上 mysqldump --help的 内容,和mysql 官网上的内容:
--single-transaction
Creates a consistent snapshot by dumping all tables in a
single transaction. Works ONLY for tables stored in
storage engines which support multiversioning (currently
only InnoDB does); the dump is NOT guaranteed to be
consistent for other storage engines. While a
--single-transaction dump is in process, to ensure a
valid dump file (correct table contents and binary log
position), no other connection should use the following
statements: ALTER TABLE, DROP TABLE, RENAME TABLE,
TRUNCATE TABLE, as consistent snapshot is not isolated
from them. Option automatically turns off --lock-tables.
-
This option sets the transaction isolation mode to
REPEATABLE READand sends aSTART TRANSACTIONSQL statement to the server before dumping data. It is useful only with transactional tables such asInnoDB, because then it dumps the consistent state of the database at the time whenSTART TRANSACTIONwas issued without blocking any applications.When using this option, you should keep in mind that only
InnoDBtables are dumped in a consistent state. For example, anyMyISAMorMEMORYtables dumped while using this option may still change state.While a
--single-transactiondump is in process, to ensure a valid dump file (correct table contents and binary log coordinates), no other connection should use the following statements:ALTER TABLE,CREATE TABLE,DROP TABLE,RENAME TABLE,TRUNCATE TABLE. A consistent read is not isolated from those statements, so use of them on a table to be dumped can cause theSELECTthat is performed by mysqldump to retrieve the table contents to obtain incorrect contents or fail.The
--single-transactionoption and the--lock-tablesoption are mutually exclusive becauseLOCK TABLEScauses any pending transactions to be committed implicitly.This option is not supported for MySQL Cluster tables; the results cannot be guaranteed to be consistent due to the fact that the
NDBCLUSTERstorage engine supports only theREAD_COMMITTEDtransaction isolation level. You should always useNDBbackup and restore instead.To dump large tables, combine the
--single-transactionoption with the--quickoption.
mysqldump 参数--single-transaction的更多相关文章
- Mysqldump 参数详解(全)
Mysqldump 参数详解(全) http://www.open-open.com/lib/view/open1358172843762.html mysqldump -S /tmp/mysql33 ...
- Mysqldump参数大全
Mysqldump参数大全(参数来源于mysql5.5.19源码) 参数 参数说明 --all-databases , -A 导出全部数据库. mysqldump -uroot -p --al ...
- mysqldump参数详细说明
Mysqldump参数大全(参数来源于mysql5.5.19源码) 参数 参数说明 --all-databases , -A 导出全部数据库. mysqldump -uroot -p --al ...
- mysqldump参数详细说明(转)
Mysqldump参数大全(参数来源于mysql5.5.19源码) 参数 参数说明 --all-databases , -A 导出全部数据库. mysqldump -uroot -p --al ...
- Mysqldump参数大全 这 些参数 不同于 mysql 的那些参数(下边文章开头有链接) :2 种类型的参数含义是不一样的
Mysqldump参数大全 这 些参数 不同于 mysql 的那些参数 :2 种类型的参数含义是不一样的 Mysqldump参数大全(参数来源于mysql5.5.19源码) 参数 参数说明 --a ...
- Mysqldump参数大全(转)
参数 参数说明 --all-databases , -A 导出全部数据库. mysqldump -uroot -p --all-databases --all-tablespaces , -Y ...
- MySQL命令mysqldump参数大全
参数参数说明--all-databases , -A导出全部数据库.mysqldump -uroot -p --all-databases--all-tablespaces , -Y导出全部表空 ...
- mysqldump 参数--lock-tables浅析
mysqldump有一个参数--lock-tables,以前对这个参数也没有详细了解过,直到上次有个网友问"参数lock-tables 是一次性锁定当前库的所有表,还是锁定当前导出表?&qu ...
- Mysqldump 参数大全
参数 参数说明 --all-databases , -A 导出全部数据库. mysqldump -uroot -p --all-databases --all-tablespaces , -Y ...
随机推荐
- JasperReports入门教程(二):中文打印
JasperReports入门教程(二):中文打印 背景 在上一篇中我们介绍了JasperReport的基本入门,也展示了一个报表.但是我们的示例都是使用的英文,如果我们把需要打印的数据改为中文会怎么 ...
- XSS语义分析的阶段性总结(二)
本文首发于“合天智汇”微信公众号,作者:Kale 前言 上次分享了javascript语义分析,并且简单介绍了新型xss扫描器的一些想法,如何在不进行大量fuzz的情况下又能准确的检测出xss漏洞,这 ...
- 二分查找(通过相对位置判断区间位置)--17--二分--LeetCode33搜索旋转排序数组
搜索旋转排序数组 假设按照升序排序的数组在预先未知的某个点上进行了旋转.( 例如,数组 [0,1,2,4,5,6,7] 可能变为 [4,5,6,7,0,1,2] ). 搜索一个给定的目标值,如果数组中 ...
- php://input和parse_str()使用
php://input可以读取没有处理过的POST数据,总结起来就是, 在用$_POST获取不到由APP或者一些接口的回调数据时,就用php://input试试 实例 index.php <fo ...
- redis部署与卸载
1.先到Redis官网(redis.io)下载redis安装包 cd /tmp wget http://download.redis.io/releases/redis-4.0.10.tar.gz 2 ...
- 【Linux题目】第九关
前言:项目整合 企业项目实战考试: 1. 全网备份解决方案实战 2. NFS集群后段共享存储搭建优化 3. 解决NFS单点实现实时数据同步. 环境: 服务器角色 外网ip 内网ip 主机名 web 1 ...
- 【DNS域名解析命令】 nslookup
1. nslookup作用 nslookup用于查询DNS的记录,查询域名解析是否正常,在网络故障时用来诊断网络问题 nslookup - query Internet name servers in ...
- mac OS npm 安装/卸载失败 权限问题解决方案
在终端输入 sudo chown -R $USER /usr/local 输入开机密码
- CSS开发技巧(三):图片点击缩放
前言 利用CSS实现图片的点击缩放是一个很值得研究的效果.在某些业务需求场景中,我们可能并没有足够的空间展示过大的图片,这就需要限制图片容器的宽度和高度.然而图片限制了宽度,一些图片的细节便又无法看 ...
- event兼容性解决
event出现undefind错误 解决方法: $('#normalImgDiv').mousemove(function (e) { var e = window.event || e; var p ...