利用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), ...
随机推荐
- easyui window窗口 不垂直居中
$('#hotelDetailWrap').window({ width: 1040, height: 160, collapsible: false, minimizable: false, max ...
- Codeforces Round #413 A. Carrot Cakes
A. Carrot Cakes time limit per test 1 second memory limit per test 256 megabytes In some game ...
- Tesseract-OCR-05-主要API功能介绍
Tesseract-05-主要API功能介绍 tesseract本身代码是由c/c++混编而成的,其中有用的简单的接口函数几乎都是在baseapi.h中 从其处理过程中,不难得出: 它还需要有一个im ...
- 用opencv做的静态图片人脸识别
这次给大家分享一个图像识别方面的小项目,主要功能是识别图像中的人脸并根据人脸在图片库找出同一个与它最相似的图片,也就是辨别不同的人. 环境:VS2013+opencv2.4.13 主要是算法:open ...
- java面试题之----Java内部类
这是我学习Java内部类的笔记 1.为什么使用内部类? 使用内部类最吸引人的原因是:每个内部类都能独立地继承一个(接口的)实现,所以无论外围类是否已经继承了某个(接口的)实现, 对于内部类都没有影响 ...
- How I explained Design Patterns to my wife: Part 1
Introduction Me and my wife had some interesting conversations on Object Oriented Design principles. ...
- Day04——Python模块
一.模块简介 模块是实现了某个功能的代码集合,比如几个.py文件可以组成代码集合即模块.其中常见的模块有os模块(系统相关),file模块(文件操作相关) 模块主要分三类: 自定义模块 :所谓自定义模 ...
- Python学习---网络文件上传
中心思想: 传递过去文件的大小,根据文件的大小判断是否文件上传完成: 传递/接受文件采用分流的形式,每次传递/接受部分数据: 文件的读取均采用绝对路径实现,而且是bytes的形式读写 客户端: # ...
- MyEcplise的注册代码
代码分析 package test; import java.io.BufferedReader; import java.io.IOException; import java.io.InputSt ...
- laravel5.5 自定义验证规则——手机验证RULE
相信很多小伙伴和我一样烦恼,laravel没有自带手机号的验证,每次验证手机号都要写正则这类的规则,每次都是repeat yourself!违背了编码的一个原则,就是Don't repeat your ...