利用MyFlash闪回丢失数据(续)
root@localhost:mysql3306.sock [(none)]::>show procedure status where db='zlm';
+-----+-------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
| Db | Name | Type | Definer | Modified | Created | Security_type | Comment | character_set_client | collation_connection | Database Collation |
+-----+-------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
| zlm | pro_flashbk | PROCEDURE | root@localhost | -- :: | -- :: | DEFINER | | utf8 | utf8_general_ci | utf8_general_ci |
+-----+-------------+-----------+----------------+---------------------+---------------------+---------------+---------+----------------------+----------------------+--------------------+
row in set (0.07 sec) root@localhost:mysql3306.sock [(none)]::>show tables from zlm;
+---------------+
| Tables_in_zlm |
+---------------+
| t1 |
| t2 |
| t3 |
| test_flashbk |
+---------------+
rows in set (0.00 sec) root@localhost:mysql3306.sock [(none)]::>drop procedure pro_flashbk;
ERROR (3D000): No database selected
root@localhost:mysql3306.sock [(none)]::>use zlm;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed
root@localhost:mysql3306.sock [zlm]::>drop procedure pro_flashbk;
Query OK, rows affected (0.02 sec) root@localhost:mysql3306.sock [zlm]::>drop table test_flashbk;
Query OK, rows affected (0.23 sec) root@localhost:mysql3306.sock [zlm]::>delimiter //
root@localhost:mysql3306.sock [zlm]::>create procedure pro_flashbk()
-> begin
-> declare id int;
-> set id = ;
-> while id> do
-> insert into test_flashbk(name) values ('aaron8219');
-> set id=id-;
-> end while;
-> end //
Query OK, rows affected (0.00 sec) root@localhost:mysql3306.sock [zlm]::>delimiter ;
root@localhost:mysql3306.sock [zlm]::>create table test_flashbk(
-> id bigint not null auto_increment,
-> name varchar() not null default '',
-> primary key(id)
-> ) engine=innodb default charset=utf8mb4;
Query OK, rows affected (0.08 sec) root@localhost:mysql3306.sock [zlm]::>call pro_flashbk();
Query OK, row affected (14.77 sec) root@localhost:mysql3306.sock [zlm]::>select count(*) from test_flashbk;
+----------+
| count(*) |
+----------+
| |
+----------+
row in set (0.04 sec) root@localhost:mysql3306.sock [zlm]::>checksum table test_flashbk;
+------------------+------------+
| Table | Checksum |
+------------------+------------+
| zlm.test_flashbk | |
+------------------+------------+
row in set (0.06 sec) root@localhost:mysql3306.sock [zlm]::>show binary logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | | | mysql-bin. | |
+------------------+-----------+
rows in set (0.00 sec)
root@localhost:mysql3306.sock [zlm]::>flush binary logs;
Query OK, rows affected (0.11 sec) root@localhost:mysql3306.sock [zlm]::>show binary logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
+------------------+-----------+
rows in set (0.00 sec) root@localhost:mysql3306.sock [zlm]::>delete from test_flashbk;
Query OK, rows affected (1.19 sec) root@localhost:mysql3306.sock [zlm]::>select count(*) from test_flashbk;
+----------+
| count(*) |
+----------+
| |
+----------+
row in set (0.00 sec) root@localhost:mysql3306.sock [zlm]::>checksum table test_flashbk;
+------------------+----------+
| Table | Checksum |
+------------------+----------+
| zlm.test_flashbk | |
+------------------+----------+
row in set (0.00 sec) root@localhost:mysql3306.sock [zlm]::>flush logs;
Query OK, rows affected (0.12 sec) root@localhost:mysql3306.sock [zlm]::>show binary logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
+------------------+-----------+
rows in set (0.00 sec) root@localhost:mysql3306.sock [zlm]::>
[root@zlm1 :: /vagrant/MyFlash-master/binary]
#ls -l
total
-rwxrwxrwx vagrant vagrant Oct flashback
-rwxrwxrwx vagrant vagrant Oct mysqlbinlog20160408 [root@zlm1 :: /vagrant/MyFlash-master/binary]
#./flashback --databaseNames zlm --tableNames test_flashbk --sqlTypes='DELETE' --binlogFileNames=/data/mysql/mysql3306/logs/mysql-bin. [root@zlm1 :: /vagrant/MyFlash-master/binary]
#ls -l
total
-rwxrwxrwx vagrant vagrant Jun : binlog_output_base.flashback
-rwxrwxrwx vagrant vagrant Oct flashback
-rwxrwxrwx vagrant vagrant Oct mysqlbinlog20160408 [root@zlm1 :: /vagrant/MyFlash-master/binary] #mysqlbinlog --skip-gtids binlog_output_base.flashback | mysql
now,let's check the records of the test table "test_flashbk" in another session with mysql client,finally you'll find the data turns back again:
root@localhost:mysql3306.sock [zlm]::>select count(*) from test_flashbk;
ERROR (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:
Current database: zlm +----------+
| count(*) | +----------+
| |
+----------+
row in set (0.04 sec) root@localhost:mysql3306.sock [zlm]::>checksum table test_flashbk;
+------------------+------------+
| Table | Checksum |
+------------------+------------+
| zlm.test_flashbk | |
+------------------+------------+
row in set (0.06 sec) root@localhost:mysql3306.sock [zlm]::>
root@localhost:mysql3306.sock [zlm]::>delete from test_flashbk;
Query OK, rows affected (1.08 sec) root@localhost:mysql3306.sock [zlm]::>checksum table test_flashbk;
+------------------+----------+
| Table | Checksum |
+------------------+----------+
| zlm.test_flashbk | |
+------------------+----------+
row in set (0.01 sec) root@localhost:mysql3306.sock [zlm]::>flush logs;
Query OK, rows affected (0.06 sec) root@localhost:mysql3306.sock [zlm]::>show binary logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
+------------------+-----------+
rows in set (0.00 sec) root@localhost:mysql3306.sock [zlm]::>call pro_flashbk();
Query OK, row affected (14.59 sec) root@localhost:mysql3306.sock [zlm]::>select count(*) from test_flashbk;
+----------+
| count(*) |
+----------+
| |
+----------+
row in set (0.03 sec) root@localhost:mysql3306.sock [zlm]::>checksum table test_flashbk;
+------------------+------------+
| Table | Checksum |
+------------------+------------+
| zlm.test_flashbk | |
+------------------+------------+
row in set (0.05 sec) root@localhost:mysql3306.sock [zlm]::>show binary logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
+------------------+-----------+
rows in set (0.00 sec)
[root@zlm1 :: /vagrant/MyFlash-master/binary]
#ls -l
total
-rwxrwxrwx vagrant vagrant Jun : binlog_output_base.flashback
-rwxrwxrwx vagrant vagrant Oct flashback
-rwxrwxrwx vagrant vagrant Oct mysqlbinlog20160408 [root@zlm1 :: /vagrant/MyFlash-master/binary]
#rm -f binlog_output_base.flashback [root@zlm1 :: /vagrant/MyFlash-master/binary]
#./flashback --databaseNames zlm --tableNames test_flashbk --sqlTypes='INSERT' --binlogFileNames=/data/mysql/mysql3306/logs/mysql-bin. [root@zlm1 :: /vagrant/MyFlash-master/binary]
#ls -l
total
-rwxrwxrwx vagrant vagrant Jun : binlog_output_base.flashback
-rwxrwxrwx vagrant vagrant Oct flashback
-rwxrwxrwx vagrant vagrant Oct mysqlbinlog20160408 [root@zlm1 :: /vagrant/MyFlash-master/binary]
#mysqlbinlog --skip-gtids binlog_output_base.flashback | mysql
root@localhost:mysql3306.sock [zlm]::>select count(*) from test_flashbk;
ERROR (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:
Current database: zlm +----------+
| count(*) |
+----------+
| |
+----------+
row in set (0.00 sec) root@localhost:mysql3306.sock [zlm]::>show binary logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
+------------------+-----------+
rows in set (0.00 sec) root@localhost:mysql3306.sock [zlm]::>checksum table test_flashbk;
ERROR (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:
Current database: zlm +------------------+----------+
| Table | Checksum |
+------------------+----------+
| zlm.test_flashbk | |
+------------------+----------+
row in set (0.00 sec) root@localhost:mysql3306.sock [zlm]::>
in the end, i test the flashback of update operation,i still get some faults:
root@localhost:mysql3306.sock [zlm]::>call pro_flashbk();
ERROR (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:
Current database: zlm Query OK, row affected (14.02 sec) root@localhost:mysql3306.sock [zlm]::>select count(*) from test_flashbk;
+----------+
| count(*) |
+----------+
| |
+----------+
row in set (0.04 sec) root@localhost:mysql3306.sock [zlm]::>checksum table test_flashbk;
+------------------+------------+
| Table | Checksum |
+------------------+------------+
| zlm.test_flashbk | |
+------------------+------------+
row in set (0.06 sec) root@localhost:mysql3306.sock [zlm]::>flush logs;
Query OK, rows affected (0.07 sec) root@localhost:mysql3306.sock [zlm]::>show binary logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
+------------------+-----------+
rows in set (0.00 sec) root@localhost:mysql3306.sock [zlm]::>update test_flashbk set name='zlm';
Query OK, rows affected (2.65 sec)
Rows matched: Changed: Warnings: root@localhost:mysql3306.sock [zlm]::>show binary logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
+------------------+-----------+
rows in set (0.00 sec)
[root@zlm1 :: /vagrant/MyFlash-master/binary]
#rm -f binlog_output_base.flashback [root@zlm1 :: /vagrant/MyFlash-master/binary]
#./flashback --databaseNames zlm --tableNames test_flashbk --sqlTypes='UPDATE' --binlogFileNames=/data/mysql/mysql3306/logs/mysql-bin. [root@zlm1 :: /vagrant/MyFlash-master/binary]
#ls -l
total
-rwxrwxrwx vagrant vagrant Jun : binlog_output_base.flashback
-rwxrwxrwx vagrant vagrant Oct flashback
-rwxrwxrwx vagrant vagrant Oct mysqlbinlog20160408 [root@zlm1 :: /vagrant/MyFlash-master/binary]
#mysqlbinlog --skip-gtids binlog_output_base.flashback | mysql
ERROR (HY000) at line : MySQL server has gone away [root@zlm1 :: /vagrant/MyFlash-master/binary]
#
root@localhost:mysql3306.sock [zlm]::>checksum table test_flashbk;
ERROR (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:
Current database: zlm +------------------+------------+
| Table | Checksum |
+------------------+------------+
| zlm.test_flashbk | |
+------------------+------------+
row in set (0.07 sec) root@localhost:mysql3306.sock [zlm]::>show binary logs;
+------------------+-----------+
| Log_name | File_size |
+------------------+-----------+
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
| mysql-bin. | |
+------------------+-----------+
rows in set (0.00 sec) root@localhost:mysql3306.sock [zlm]::>select count(*) from test_flashbk where name='aaron8219';
+----------+
| count(*) |
+----------+
| |
+----------+
row in set (0.04 sec) root@localhost:mysql3306.sock [zlm]::>
- MyFlash is fast and convenient to flashback some insertion and deletion operations.
- it still has some unpredictable issue when doing flashback of update.
- as far as i know,it is faster then another tool named "binlog2sql" which one is released by Mertuan-Dianping too.
利用MyFlash闪回丢失数据(续)的更多相关文章
- 利用MyFlash闪回丢失数据
MyFlash is an open source tool released by Meituan-Dianping which can be used to flashback MyS ...
- 利用mysqlbinlog_flashback闪回丢失数据
today,i'll have a test with the open source tool mysqlbinlog_flashback which is released by ...
- 利用binlog2sql闪回丢失数据
today,i'll using the open source tool named "binlog2sql" which is release by danfengch ...
- MyFlash闪回恢复数据
使用限制: .binlog格式必须为row,且binlog_row_image=full. .仅支持5.6与5.. .只能回滚DML(增.删.改). .mysqlbinlog版本请保持一致. 1.安装 ...
- oracle_利用闪回功能恢复数据
方便起见一般:执行如下即可不用往下看: ① 启用行移动功能 alter table tbl_a enable row movement; ② 闪回表数据到某个时间点 flashback table t ...
- Oracle 闪回 找回数据的实现方法
Oracle 闪回 找回数据的实现方法 闪回技术是Oracle强大数据库备份恢复机制的一部分,在数据库发生逻辑错误的时候,闪回技术能提供快速且最小损失的恢复.这篇文章主要介绍了Oracle 闪回 找回 ...
- Oracle闪回技术之一Oracle 11g 利用FlashTable (闪回表)恢复(用delete)误删的数据
闪回表,实际上就是将表中的数据快速恢复到过去的一个时间点或者系统改变号SCN上.实现表的闪回,需要用到撤销表空间相关的UNDO信息,通过SHOW PARAMETER UNDO命令就可以了解这些信息.用 ...
- Flashback Version Query、Flashback Transaction Query快速闪回细粒度数据
Flashback Version Query 闪回版本查询 使用Flashback Version Query 返回在指定时间间隔或SCN间隔内的所有版本,一次commit命令就会创建一个版本. ...
- Oracle 闪回 找回数据
使用闪回技术,实现基于磁盘上闪回恢复区的自动备份与还原. 一.恢复表对象 1.创建学生表 create table STUDENT ( idno INTEGER, name VARCHAR2(30), ...
随机推荐
- JavaWeb中Servlet和JSP的分工案例
jsp和Servlet的分工: * JSP: > 作为请求发起页面,例如显示表单.超链接. > 作为请求结束页面,例如显示数据. * Servlet: &g ...
- 【创客+】偷心锁屏创始人Jerry创业心得分享
偷心锁屏创始人Jerry创业心得分享 作者:Jerry权泉,偷心锁屏创始人 我创业的起因非常偶然.08年在东京早稻田大学读博士期间,每周六都去社区活动中心跟日本人志愿者日语对话练习日语.有一次练习结束 ...
- 【转】My App Crashed, Now What? – Part 1
原文地址:http://www.raywenderlich.com/10209/my-app-crashed-now-what-part-1 By Matthijs Hollemans on Mar ...
- webStrorm 简单配置
1.主题配色 主题设置 File -> Settings -> Appearance & Behavior -> Appearance ->Theme. ===& ...
- C#接收WebSphere MQ中文乱码问题
最近在用IBM的WebSphere MQ做数据传输,客户端操作系统Windows,服务器是AIX,我们用的都是UTF-8编码,但是联调时发现带中文的都出现了乱码.折腾了好久才发现问题,原来是CCSID ...
- Visio中锁定元件
若要进行形状保护,需要能看到“开发工具”选项卡.默认情况下,该选项卡是隐藏的. 查看“开发工具”选项卡 单击“文件”选项卡. 单击“选项”. 单击“高级”,然后向下滚动到“常规”部分. 选择“以开发人 ...
- 图的存储结构(邻接矩阵与邻接表)及其C++实现
一.图的定义 图是由顶点的有穷非空集合和顶点之间边的集合组成,通常表示为: G=(V,E) 其中:G表示一个图,V是图G中顶点的集合,E是图G中顶点之间边的集合. 注: 在线性表中,元素个数可以为零, ...
- June 25th 2017 Week 26th Sunday
There is always that one song that brings back old memories. 总有那么一首歌,让你想起那些旧的回忆. There are seveal so ...
- ZT UML 类与类之间的关系
1.聚合关系是关联关系的一种,是强的关联关系. 2.聚合是整体和部分之间的关系,例如汽车由引擎.轮胎以及其它零件组成. 3.聚合关系也是通过成员变量来实现的.但是,关联关系所涉及的两个类处在同 ...
- API 网关
使用 API 网关 链接:https://github.com/oopsguy/microservices-from-design-to-deployment-chinese译者:Oopsguy ...