MySQL 单表flashback

一、软件安装

yum install python-pip

git clone https://github.com/danfengcao/binlog2sql.git

pip install -r requirements.txt

二、编写脚本

vi bin_flashback.sh

===============================================================================================

#!/bin/sh

python binlog2sql.py -h10.0.0.47 -uadmin -p'xxxxx' -d mydb -t mytab -B --start-file=$1 --start-pos=4|grep update -i>$1.sql

三、按条件检索

cat mysql-bin.005375.sql |awk '{print$11,$38,$6,$28}'|awk -F[\`] '{print$7$9}'|sort |uniq -c

附:实际并不需要检索,对于update语句,使用编辑工具去掉不必要的字段即可

类似的美团MyFlash工具https://github.com/Meituan-Dianping/MyFlash/blob/master/doc/how_to_use.md

MyFlash——美团点评的开源MySQL闪回工具

原文地址:https://www.cnblogs.com/geek-ace/p/7340264.html