last night,i've tested flashback by MyFlash tool,but failed,now let's do some other test with it.first of all,clear the test environment:drop the procedure and table created yesterday.
 
 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)
 
    in order to make sure what binary log i need to generate the flashback file,i use "flush binary logs" and "show binary logs" to mark the explicit binary log(here is the mysql-bin.000027).after that,i do the deletion operation by intentionally forget to use where clause,obviously all the records in the test table "test_flashbk" will be deleted in the end as below:
 
 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]::>
 
    then,i will use MyFlash tool to generate the flashback file which will contain the miss deleted records of the test table by the operatoin just now.
 
 [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]::>
     moreover,i test the flashback of insertion operation as below:

 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]::>
    i guess,there're some compatibility issues with the tool,'cause i got the inscrutable phenomenon when using it doing flashback of update operation last night.
 
Summary:
  • 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闪回丢失数据(续)的更多相关文章

  1. 利用MyFlash闪回丢失数据

          MyFlash is an open source tool released by Meituan-Dianping which can be used to flashback MyS ...

  2. 利用mysqlbinlog_flashback闪回丢失数据

            today,i'll have a test with the open source tool mysqlbinlog_flashback which is released by ...

  3. 利用binlog2sql闪回丢失数据

        today,i'll using the open source tool named "binlog2sql" which is release by danfengch ...

  4. MyFlash闪回恢复数据

    使用限制: .binlog格式必须为row,且binlog_row_image=full. .仅支持5.6与5.. .只能回滚DML(增.删.改). .mysqlbinlog版本请保持一致. 1.安装 ...

  5. oracle_利用闪回功能恢复数据

    方便起见一般:执行如下即可不用往下看: ① 启用行移动功能 alter table tbl_a enable row movement; ② 闪回表数据到某个时间点 flashback table t ...

  6. Oracle 闪回 找回数据的实现方法

    Oracle 闪回 找回数据的实现方法 闪回技术是Oracle强大数据库备份恢复机制的一部分,在数据库发生逻辑错误的时候,闪回技术能提供快速且最小损失的恢复.这篇文章主要介绍了Oracle 闪回 找回 ...

  7. Oracle闪回技术之一Oracle 11g 利用FlashTable (闪回表)恢复(用delete)误删的数据

    闪回表,实际上就是将表中的数据快速恢复到过去的一个时间点或者系统改变号SCN上.实现表的闪回,需要用到撤销表空间相关的UNDO信息,通过SHOW PARAMETER UNDO命令就可以了解这些信息.用 ...

  8. Flashback Version Query、Flashback Transaction Query快速闪回细粒度数据

    Flashback Version Query 闪回版本查询 使用Flashback Version Query  返回在指定时间间隔或SCN间隔内的所有版本,一次commit命令就会创建一个版本. ...

  9. Oracle 闪回 找回数据

    使用闪回技术,实现基于磁盘上闪回恢复区的自动备份与还原. 一.恢复表对象 1.创建学生表 create table STUDENT ( idno INTEGER, name VARCHAR2(30), ...

随机推荐

  1. 001Spring 定时任务 Scheduled

    01.@Scheduled注解参数 @Scheduled支持fixedRate.fixedDelay.cron表达式参数.其中,fixedRate和fixedDelay没有区别,都是启动时执行1次,每 ...

  2. Python爬虫教程-25-数据提取-BeautifulSoup4(三)

    Python爬虫教程-25-数据提取-BeautifulSoup4(三) 本篇介绍 BeautifulSoup 中的 css 选择器 css 选择器 使用 soup.select 返回一个列表 通过标 ...

  3. js结构化命名的思考

    var koooke ={androidShare:{ show : function() {alert(1000)}}};koooke.androidShare.show(); 以上JS是偶然缩写. ...

  4. SpringMVC学习(三)——基于注解配置的springMVC项目

    可运行的附件地址:http://files.cnblogs.com/files/douJiangYouTiao888/springWithAnnotation.zip 项目说明: 作者环境:maven ...

  5. 设计模式:解释器(Interpreter)模式

    设计模式:解释器(Interpreter)模式 一.前言 这是我们23个设计模式中最后一个设计模式了,大家或许也没想到吧,竟然是编译原理上的编译器,这样说可能不对,因为编译器分为几个部分组成呢,比如词 ...

  6. Java 基本IO操作

    1.基本IO操作     有时候我们编写的程序除了自身会定义一些数据信息外,还需要引用外界的数据,或是将自身的数据发送到外界,这时我们需要使用输入与输出. 1)输入与输出       输入:是一个从外 ...

  7. ppt中调整图片位置

    按方向键时,如果调整的位置过大,可以使用 Ctrl + 方向键.

  8. February 13 2017 Week 7 Monday

    Don't trouble trouble until trouble troubles you. 不要自寻烦恼. It is the best way to live an easy life if ...

  9. zt C++ list 类学习笔记

    C++ list 类学习笔记 分类: C++ 2011-09-29 00:12 7819人阅读 评论(0) 收藏 举报 listc++iteratorvectorcconstructor 双向循环链表 ...

  10. .NET Core学习之路

    1.NET Core环境搭建 安装.NET Core: .NET Core 包括.NET Core Runtime 和 .NET Core SDK: NET Core = 应用运行依赖的 .NET C ...