测试percona-data-recovery-tool是否能恢复被truncate的数据

版本:
mysql> select version();
+-------------------------------------------+
| version()                                 |
+-------------------------------------------+
| 5.6.22-enterprise-commercial-advanced-log |
+-------------------------------------------+

mysql> use livekoo;
Database changed
mysql> select count(*) from live_room;
+----------+
| count(*) |
+----------+
|     1437 |
+----------+
1 row in set (0.00 sec)

mysql> truncate table live_room;
Query OK, 0 rows affected (0.01 sec)

mysql> select count(*) from live_room;
+----------+
| count(*) |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

开始恢复:
[root@test11g percona-data-recovery-tool]#  ./page_parser -5 -f /tol/mysql/data/livekoo/live_room.ibd 
Opening file: /tol/mysql/data/livekoo/live_room.ibd:
2065            ID of device containing file
252192856               inode number
33200           protection
1               number of hard links
27              user ID of owner
27              group ID of owner
0               device ID (if special file)
114688          total size, in bytes
4096            blocksize for filesystem I/O
224             number of blocks allocated
1420109797      time of last access
1420109799      time of last modification
1420109799      time of last status change
114688  Size to process in bytes
104857600       Disk cache size in bytes
[root@test11g percona-data-recovery-tool]#  ./create_defs.pl -host 192.168.100.141 -user root -password root -db livekoo -table live_room >include/table_defs.h 
DBI connect('database=livekoo;host=192.168.100.141;port=3306','root',...) failed: Host '192.168.100.141' is not allowed to connect to this MySQL server at ./create_defs.pl line 37
[root@test11g percona-data-recovery-tool]#  ./create_defs.pl -host 192.168.100.141 -user root -password root -db livekoo -table live_room >include/table_defs.h

重新编译
[root@test11g percona-data-recovery-tool]# make
gcc -DHAVE_OFFSET64_T -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -D_LARGEFILE_SOURCE=1 -Wall -O3 -g -I include -I mysql-source/include -I mysql-source/innobase/include -c tables_dict.c -o lib/tables_dict.o
gcc -DHAVE_OFFSET64_T -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -D_LARGEFILE_SOURCE=1 -Wall -O3 -g -I include -I mysql-source/include -I mysql-source/innobase/include -c check_data.c -o lib/check_data.o
gcc -DHAVE_OFFSET64_T -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -D_LARGEFILE_SOURCE=1 -Wall -O3 -g -I include -I mysql-source/include -I mysql-source/innobase/include -o constraints_parser constraints_parser.c lib/tables_dict.o lib/print_data.o lib/check_data.o lib/libut.a lib/libmystrings.a
gcc -DHAVE_OFFSET64_T -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE=1 -D_LARGEFILE_SOURCE=1 -Wall -O3 -g -I include -I mysql-source/include -I mysql-source/innobase/include  -o page_parser page_parser.c lib/tables_dict.o lib/libut.a 
[root@test11g percona-data-recovery-tool]# ./constraints_parser -5 -D -f pages-1420109824/FIL_PAGE_INDEX/0-2 >/tmp/live_room.data 
0-26/ 0-27/ 
[root@test11g percona-data-recovery-tool]# ./constraints_parser -5 -D -f pages-1420109824/FIL_PAGE_INDEX/0-26 >/tmp/live_room.data
LOAD DATA INFILE '/root/percona-data-recovery-tool/dumps/default/live_room' REPLACE INTO TABLE `live_room` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'live_room\t' (id, consumer_type, consumer_id, provider_type, status);
[root@test11g percona-data-recovery-tool]# ./constraints_parser -5 -D -f pages-1420109824/FIL_PAGE_INDEX/0-27 >>/tmp/live_room.data
LOAD DATA INFILE '/root/percona-data-recovery-tool/dumps/default/live_room' REPLACE INTO TABLE `live_room` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'live_room\t' (id, consumer_type, consumer_id, provider_type, status);

查看恢复出来的文件,发现没有数据,说明这个工具无法恢复被truncate的表数据
[root@test11g percona-data-recovery-tool]# wc -l /tmp/live_room.data 
0 /tmp/live_room.data
[root@test11g percona-data-recovery-tool]# more /tmp/live_room.data 
[root@test11g percona-data-recovery-tool]# 



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23249684/viewspace-1387020/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/23249684/viewspace-1387020/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值