MySQL手动执行rollback,内部实现分析

-- 测试手动回滚操作
-- 1手动开启事务
START TRANSACTION 
-- 2执行更新操作语句
UPDATE FraBakNtuAnalysize SET IsDeleted = 0 WHERE ColData = '2020-02-10' 
-- 3更新后查询
SELECT DISTINCT
	DATE_FORMAT( ColData, '%Y-%m-%d' ) AS ColData,
	IsDeleted 
FROM
	FraBakNtuAnalysize 
WHERE
	ColData = '2020-02-10'
-- 	手动执行回滚操作
ROLLBACK
-- 查询回滚后,更新操作之前的数据,即未执行更新操作时候的原始数据
SELECT DISTINCT
	DATE_FORMAT( ColData, '%Y-%m-%d' ) AS ColData,
	IsDeleted 
FROM
	FraBakNtuAnalysize 
WHERE
	ColData = '2020-02-10'
-- 	涉及概念 undolog redolog 等等
undolog redolog binlog 概念阐述:有时间再写

  

posted on 2021-05-12 17:06  王半仙儿的博客  阅读(259)  评论(0编辑  收藏  举报

导航