利用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), ...
随机推荐
- Java入门到精通——调错篇之Astah Community打开报需要jre1.7运行环境
1.问题概述 Astah Community安装完以后点击运行Astah Community的时候报此应用需要jdk1.7如下图 但是我的电脑在D盘装了jdk1.8了为什么这个软件为什 ...
- KMP算法的一个简单实现
今天学习KMP算法,参考网上内容,实现算法,摘录网页内容并记录自己的实现如下: 原文出处: http://www.ruanyifeng.com/blog/2013/05/Knuth%E2%80%93M ...
- 08_Spring自定义标签
[ 项目工程 ] [ Person.java 模型类 ] package com.spring.selfxml.model; /** * Created by HigginCui on 2018/9/ ...
- 05_dubbo_aop
[对这行代码进行源码分析] ExtensionLoader<Protocol> loader = ExtensionLoader.getExtensionLoader(Protocol.c ...
- 01_Jdk自带SPI
[SPI的设计目标] 面向对象的设计里,模块之间是基于接口编程,模块之间不对实现类进行硬编码. 一旦代码里设计具体的实现类,就违法了可插拔的原则,如果需要替代一种实现,就要修改代码. 为了实现在模块装 ...
- 02_NIO简单实例
[一个用NIO实现的客户端向服务端单向通信的例子] [服务端程序] package com.nio.test; import java.io.IOException; import java.net. ...
- 03_ActiveMQ安全机制
[ActiveMQ安全机制] [ ActiveMQ的web管理界面 ] 地址 http://127.0.0.1:8161/admin ActiveMQ管理控制台使用jetty部署,所以需要修改密码, ...
- Android学习——ListView的缓存机制
在使用ListView的时候,需要加载适配器和数据源,这篇文章主要介绍一下ListView的使用以及利用ListView的缓存机制来减少系统的初始化时间. ListView的使用 ListView和V ...
- atom 常用配置
基本配置 setting 位于 File -> setting 显示HTML标签闭合的竖线 Setting -> Editor Setting -> 勾选 Show Indent G ...
- 根据viewport的size自动调整fontsize大小
现在的网站必须要考虑mobile上访问的友好性,bootstrap作为mobile first的前端框架得到很多应用,它通过默认就使用.col-xs-xx定义的width,同时加上@media(min ...