MySQL数据块损坏的恢复

数据页损坏
常规情况下如数据库出现坏块,如果数据库出现极端情况导致innodb_force_recovery=6,无法恢复,需要直接读取ibd 文件数据进行恢复,因此整体的恢复思路是把数据从ibd 读取出来,恢复到另外一个实例中

1.创建测试表

mysql> create table student(stu_id int(12),stu_name varchar(20));
Query OK, 0 rows affected (0.06 sec)
mysql> DELIMITER $
mysql> CREATE PROCEDURE proc_initData()
    -> BEGIN
    ->     DECLARE i INT DEFAULT 1;
    ->     WHILE i<=10000 DO ->         INSERT INTO student (stu_id,stu_name) VALUES(i,concat("张三",i));
    ->         SET i = i+1;
    ->     END WHILE;
    -> END $
Query OK, 0 rows affected (0.01 sec)

mysql> DELIMITER ;
mysql> CALL proc_initData();
Query OK, 1 row affected (4 min 3.81 sec)

mysql> commit;
Query OK, 0 rows affected (0.00 sec)

mysql> select count(*) from student;
+----------+
| count(*) |
+----------+
|    10000 |
+----------+
1 row in set (0.01 sec)

2.标记某个数据块为坏块

[root@localhost soft]# ./bcview /mysqldata/mysql/test/student.ibd 16 0 4
******************************************************************
This Tool Is Uesed For Find The Data In Binary format(Hexadecimal)
Usage:./bcview file blocksize offset cnt-bytes!
file: Is Your File Will To Find Data!
blocksize: Is N kb Block.Eg: 8 Is 8 Kb Blocksize(Oracle)!
                         Eg: 16 Is 16 Kb Blocksize(Innodb)!
offset:Is Every Block Offset Your Want Start!
cnt-bytes:Is After Offset,How Bytes Your Want Gets!
Edtor QQ:22389860!
Used gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
******************************************************************
----Current file size is :0.515625 Mb
----Current use set blockszie is 16 Kb
----Current file name is /mysqldata/mysql/test/student.ibd
current block:00000000--Offset:00000--cnt bytes:04--data is:808a1848
current block:00000001--Offset:00000--cnt bytes:04--data is:7e4a1bda
current block:00000002--Offset:00000--cnt bytes:04--data is:edb00808
current block:00000003--Offset:00000--cnt bytes:04--data is:572aacd7
current block:00000004--Offset:00000--cnt bytes:04--data is:c8d8b056
current block:00000005--Offset:00000--cnt bytes:04--data is:a216e84e
current block:00000006--Offset:00000--cnt bytes:04--data is:3c61ba87
current block:00000007--Offset:00000--cnt bytes:04--data is:f029a1f5
current block:00000008--Offset:00000--cnt bytes:04--data is:100e39cc
current block:00000009--Offset:00000--cnt bytes:04--data is:076fb5f1
current block:00000010--Offset:00000--cnt bytes:04--data is:7274b593
current block:00000011--Offset:00000--cnt bytes:04--data is:db3e0380
current block:00000012--Offset:00000--cnt bytes:04--data is:4ba9595f
current block:00000013--Offset:00000--cnt bytes:04--data is:614beb2e
current block:00000014--Offset:00000--cnt bytes:04--data is:6d3eafa2
current block:00000015--Offset:00000--cnt bytes:04--data is:02aa16e8
current block:00000016--Offset:00000--cnt bytes:04--data is:9d89e9d8
current block:00000017--Offset:00000--cnt bytes:04--data is:6df78bcf
current block:00000018--Offset:00000--cnt bytes:04--data is:2bacdd4d
current block:00000019--Offset:00000--cnt bytes:04--data is:5aec928c
current block:00000020--Offset:00000--cnt bytes:04--data is:f8645813
current block:00000021--Offset:00000--cnt bytes:04--data is:6fe5578f
current block:00000022--Offset:00000--cnt bytes:04--data is:9bfdc9da
current block:00000023--Offset:00000--cnt bytes:04--data is:02cf14da
current block:00000024--Offset:00000--cnt bytes:04--data is:428d4784
current block:00000025--Offset:00000--cnt bytes:04--data is:b2ef644d
current block:00000026--Offset:00000--cnt bytes:04--data is:7759cc93
current block:00000027--Offset:00000--cnt bytes:04--data is:a68e54f6
current block:00000028--Offset:00000--cnt bytes:04--data is:711ad7b5
current block:00000029--Offset:00000--cnt bytes:04--data is:d5c3ea4b
current block:00000030--Offset:00000--cnt bytes:04--data is:b0dfed41
current block:00000031--Offset:00000--cnt bytes:04--data is:ebb3250c
current block:00000032--Offset:00000--cnt bytes:04--data is:00000000
[root@localhost soft]# ./bctool /mysqldata/mysql/test/student.ibd 2 0 11111111
******************************************************************
This tool is uesed to check data ues binary format,no Big-Endian
or Little-Endian diff,this tool is base one byte on byte to change
!block is 16k.if want change other block eg:8k! please set blocks
0 and offset blocks*8192+offset!
usage:./bctool yfile blocks offset yourdata(XX)!
Warings:backup file frist!!!!!!!!!
Editor QQ:22389860
Ues gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
******************************************************************
11-11-11-11

重启mysql服务

2024-03-19T07:07:20.192633Z 0 [ERROR] InnoDB: Database page corruption on disk or a failed file read of page [page id: space=51, page number=2]. You may have to recover from a backup.
2024-03-19T07:07:20.192684Z 0 [Note] InnoDB: Page dump in ascii and hex (16384 bytes):
 len 16384; hex 11111111000000020000000000000000000000000089ae2b0003000000000000000000000033ffffffff2024-03-19T07:07:20.193910Z 0 [Note] Failed to start slave threads for channel ''
0000ffffffff000000000000000000010000000000000000ffffffff0000ffffffff000000000000ffffffff0000ffffffff000000000000ffffffff0000ffffffff000005d669d200000003ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000000000020000000000000000ffffffff0000ffffffff000000000000ffffffff0000ffffffff000000000000ffffffff0000ffffffff000005d669d20000000400000005000000060000000700000008000000090000000a0000000b0000000c0000000d0000000e0000000f000000100000001100000012000000130000001400000015000000160000001700000018000000190000001a0000001b0000001c0000001d0000001e0000001fffffffffffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002024-03-19T07:07:20.211011Z 0 [Note] Event Scheduler: Loaded 0 events

扫描数据字典文件
一般情况下表结构是存储在frm 文件中,drop table 会删除frm 文件,还好我们可以从innodb 系统表里读取一些信息恢复表结构。innodb 系统表有SYS_COLUMNS | SYS_FIELDS |SYS_INDEXES | SYS_TABLES。需要从系统表中恢复,而系统表是保存在$datadir/ibdata1 文件中的解析ibdata 文件,扫描出所有符合innodb 格式的数据页,结果会按照index_id 进行重新组织

[root@localhost undrop-for-innodb-master]# ./stream_parser -f /mysqldata/mysql/ibdata1
Opening file: /mysqldata/mysql/ibdata1
File information:

ID of device containing file:        64768
inode number:                      4591360
protection:                         100640 (regular file)
number of hard links:                    1
user ID of owner:                       27
group ID of owner:                      27
device ID (if special file):             0
blocksize for filesystem I/O:         4096
number of blocks allocated:         151560
Opening file: /mysqldata/mysql/ibdata1
File information:

ID of device containing file:        64768
inode number:                      4591360
protection:                         100640 (regular file)
number of hard links:                    1
user ID of owner:                       27
group ID of owner:                      27
device ID (if special file):             0
blocksize for filesystem I/O:         4096
number of blocks allocated:         151560
time of last access:            1710832037 Tue Mar 19 15:07:17 2024
time of last modification:      1710832037 Tue Mar 19 15:07:17 2024
time of last status change:     1710832037 Tue Mar 19 15:07:17 2024
total size, in bytes:             77594624 (74.000 MiB)

Size to process:                  77594624 (74.000 MiB)
time of last access:            1710832037 Tue Mar 19 15:07:17 2024
time of last modification:      1710832037 Tue Mar 19 15:07:17 2024
time of last status change:     1710832037 Tue Mar 19 15:07:17 2024
total size, in bytes:             77594624 (74.000 MiB)

Size to process:                  77594624 (74.000 MiB)
Opening file: /mysqldata/mysql/ibdata1
File information:

ID of device containing file:        64768
inode number:                      4591360
protection:                         100640 (regular file)
number of hard links:                    1
user ID of owner:                       27
group ID of owner:                      27
device ID (if special file):             0
blocksize for filesystem I/O:         4096
number of blocks allocated:         151560
Opening file: /mysqldata/mysql/ibdata1
File information:

ID of device containing file:        64768
inode number:                      4591360
protection:                         100640 (regular file)
number of hard links:                    1
user ID of owner:                       27
group ID of owner:                      27
device ID (if special file):             0
blocksize for filesystem I/O:         4096
number of blocks allocated:         151560
time of last access:            1710832037 Tue Mar 19 15:07:17 2024
time of last modification:      1710832037 Tue Mar 19 15:07:17 2024
time of last status change:     1710832037 Tue Mar 19 15:07:17 2024
total size, in bytes:             77594624 (74.000 MiB)

Size to process:                  77594624 (74.000 MiB)
time of last access:            1710832037 Tue Mar 19 15:07:17 2024
time of last modification:      1710832037 Tue Mar 19 15:07:17 2024
time of last status change:     1710832037 Tue Mar 19 15:07:17 2024
total size, in bytes:             77594624 (74.000 MiB)

Size to process:                  77594624 (74.000 MiB)
All workers finished in 0 sec

扫描数据文件

[root@localhost undrop-for-innodb-master]# ./stream_parser -f /mysqldata/mysql/test/student.ibd
Opening file: /mysqldata/mysql/test/student.ibd
File information:

ID of device containing file:        64768
inode number:                    139912091
protection:                         100640 (regular file)
number of hard links:                    1
user ID of owner:                       27
Opening file: /mysqldata/mysql/test/student.ibd
group ID of owner:                      27
device ID (if special file):             0
blocksize for filesystem I/O:         4096
File information:

number of blocks allocated:           1064
ID of device containing file:        64768
inode number:                    139912091
protection:                         100640 (regular file)
number of hard links:                    1
user ID of owner:                       27
group ID of owner:                      27
device ID (if special file):             0
blocksize for filesystem I/O:         4096
number of blocks allocated:           1064
time of last access:            1710832027 Tue Mar 19 15:07:07 2024
time of last modification:      1710832014 Tue Mar 19 15:06:54 2024
time of last status change:     1710832014 Tue Mar 19 15:06:54 2024
total size, in bytes:               540672 (528.000 kiB)

time of last access:            1710832027 Tue Mar 19 15:07:07 2024
time of last modification:      1710832014 Tue Mar 19 15:06:54 2024
Size to process:                    540672 (528.000 kiB)
time of last status change:     1710832014 Tue Mar 19 15:06:54 2024
total size, in bytes:               540672 (528.000 kiB)

Size to process:                    540672 (528.000 kiB)
Opening file: /mysqldata/mysql/test/student.ibd
File information:

ID of device containing file:        64768
inode number:                    139912091
protection:                         100640 (regular file)
number of hard links:                    1
user ID of owner:                       27
group ID of owner:                      27
device ID (if special file):             0
blocksize for filesystem I/O:         4096
number of blocks allocated:           1064
Opening file: /mysqldata/mysql/test/student.ibd
File information:

ID of device containing file:        64768
inode number:                    139912091
protection:                         100640 (regular file)
number of hard links:                    1
user ID of owner:                       27
group ID of owner:                      27
device ID (if special file):             0
blocksize for filesystem I/O:         4096
number of blocks allocated:           1064
time of last access:            1710832027 Tue Mar 19 15:07:07 2024
time of last modification:      1710832014 Tue Mar 19 15:06:54 2024
time of last status change:     1710832014 Tue Mar 19 15:06:54 2024
total size, in bytes:               540672 (528.000 kiB)

Size to process:                    540672 (528.000 kiB)
time of last access:            1710832027 Tue Mar 19 15:07:07 2024
time of last modification:      1710832014 Tue Mar 19 15:06:54 2024
time of last status change:     1710832014 Tue Mar 19 15:06:54 2024
total size, in bytes:               540672 (528.000 kiB)

Size to process:                    540672 (528.000 kiB)
All workers finished in 0 sec

获取table_id

[root@localhost undrop-for-innodb-master]# ./c_parser -4f pages-ibdata1/FIL_PAGE_INDEX/0000000000000001.page -t dictionary/SYS_TABLES.sql | grep student
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/undrop-for-innodb-master/dumps/default/SYS_TABLES' REPLACE INTO TABLE `SYS_TABLES` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'SYS_TABLES\t' (`NAME`, `ID`, `N_COLS`, `TYPE`, `MIX_ID`, `MIX_LEN`, `CLUSTER_NAME`, `SPACE`);
000000004808    A80000011B0110  SYS_TABLES      "test/student"  63      2       33      0       80      ""      51

获取index_id
[root@localhost undrop-for-innodb-master]# ./c_parser -4f pages-ibdata1/FIL_PAGE_INDEX/0000000000000003.page -t dictionary/SYS_INDEXES.sql | grep 63
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/undrop-for-innodb-master/dumps/default/SYS_INDEXES' REPLACE INTO TABLE `SYS_INDEXES` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'SYS_INDEXES\t' (`TABLE_ID`, `ID`, `NAME`, `N_FIELDS`, `TYPE`, `SPACE`, `PAGE_NO`);
000000004808    A80000011B0166  SYS_INDEXES     63      52      "GEN\_CLUST\_INDEX"     0       1       51      3

解析获得ddl 语句

[root@localhost scripts-2.7]# mysqlfrm --diagnostic /mysqldata/mysql/test/student.frm |grep -v "^#"

CREATE TABLE `test`.`student` (
  `stu_id` int(12) DEFAULT NULL,
  `stu_name` varchar(80) DEFAULT NULL
) ENGINE=InnoDB;

[root@localhost tmp]# vi student.sql
CREATE TABLE `student` (
  `stu_id` int(12) DEFAULT NULL,
  `stu_name` varchar(80) DEFAULT NULL
) ENGINE=InnoDB;

解析对应的page 页数据
请注意表结构中不要带有中文和schema_name

[root@localhost undrop-for-innodb-master]# ./c_parser -6f  pages-student.ibd/FIL_PAGE_INDEX/0000000000000052.page -t /tmp/student.sql > dumps/default/student 2> dumps/default/student.sql

[root@localhost undrop-for-innodb-master]# more dumps/default/student.sql
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/undrop-for-innodb-master/dumps/default/student' REPLACE INTO TABLE `student` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'student\t' (`stu_id`, `stu_name`);
[root@localhost undrop-for-innodb-master]# more dumps/default/student
-- Page id: 9, Format: COMPACT, Records list: Valid, Expected records: (376 376)
0000000039B4    0000000050CD    C5000001770110  student 1717    "张三1717"
0000000039B5    0000000050CE    C6000001780110  student 1718    "张三1718"
0000000039B6    0000000050CF    C7000001790110  student 1719    "张三1719"
0000000039B7    0000000050D0    C80000017A0110  student 1720    "张三1720"
0000000039B8    0000000050D1    C90000017B0110  student 1721    "张三1721"
0000000039B9    0000000050D2    CA000001540110  student 1722    "张三1722"
0000000039BA    0000000050D3    CB000001550110  student 1723    "张三1723"
0000000039BB    0000000050D4    CC000001560110  student 1724    "张三1724"
0000000039BC    0000000050D5    CD000001570110  student 1725    "张三1725"
0000000039BD    0000000050D6    CE000001580110  student 1726    "张三1726"
0000000039BE    0000000050D7    CF000001590110  student 1727    "张三1727"
0000000039BF    0000000050D8    D00000015A0110  student 1728    "张三1728"
0000000039C0    0000000050D9    D10000015B0110  student 1729    "张三1729"
0000000039C1    0000000050DA    D20000015C0110  student 1730    "张三1730"
0000000039C2    0000000050DB    D30000015D0110  student 1731    "张三1731"
0000000039C3    0000000050DC    D40000015E0110  student 1732    "张三1732"
0000000039C4    0000000050DD    D50000015F0110  student 1733    "张三1733"
0000000039C5    0000000050DE    D60000017C0110  student 1734    "张三1734"
0000000039C6    0000000050DF    D70000017D0110  student 1735    "张三1735"
0000000039C7    0000000050E0    D80000017E0110  student 1736    "张三1736"
0000000039C8    0000000050E1    D90000017F0110  student 1737    "张三1737"
0000000039C9    0000000050E2    DA000001610110  student 1738    "张三1738"
0000000039CA    0000000050E3    DB000001800110  student 1739    "张三1739"
0000000039CB    0000000050E4    DC000001630110  student 1740    "张三1740"
0000000039CC    0000000050E5    DD000001810110  student 1741    "张三1741"
0000000039CD    0000000050E6    DE000001820110  student 1742    "张三1742"
0000000039CE    0000000050E7    DF000001830110  student 1743    "张三1743"
0000000039CF    0000000050E8    E0000001840110  student 1744    "张三1744"
0000000039D0    0000000050E9    E1000001850110  student 1745    "张三1745"
0000000039D1    0000000050EA    E2000001860110  student 1746    "张三1746"
0000000039D2    0000000050EB    E3000001870110  student 1747    "张三1747"
0000000039D3    0000000050EC    E4000001880110  student 1748    "张三1748"
0000000039D4    0000000050ED    E5000001890110  student 1749    "张三1749"
0000000039D5    0000000050EE    E60000018A0110  student 1750    "张三1750"
0000000039D6    0000000050EF    E70000018B0110  student 1751    "张三1751"
0000000039D7    0000000050F0    E80000018C0110  student 1752    "张三1752"
0000000039D8    0000000050F1    E90000018D0110  student 1753    "张三1753"
0000000039D9    0000000050F2    EA0000018E0110  student 1754    "张三1754"
0000000039DA    0000000050F3    EB0000018F0110  student 1755    "张三1755"
0000000039DB    0000000050F4    EC000001900110  student 1756    "张三1756"
0000000039DC    0000000050F5    ED000001910110  student 1757    "张三1757"
0000000039DD    0000000050F6    EE000001920110  student 1758    "张三1758"
0000000039DE    0000000050F7    EF000001930110  student 1759    "张三1759"
0000000039DF    0000000050F8    F0000001940110  student 1760    "张三1760"
0000000039E0    0000000050F9    F1000001950110  student 1761    "张三1761"
0000000039E1    0000000050FA    F2000001960110  student 1762    "张三1762"
0000000039E2    0000000050FB    F3000001970110  student 1763    "张三1763"
0000000039E3    0000000050FC    F4000001990110  student 1764    "张三1764"
0000000039E4    0000000050FD    F50000019A0110  student 1765    "张三1765"
0000000039E5    0000000050FE    F60000019B0110  student 1766    "张三1766"
0000000039E6    0000000050FF    F70000019C0110  student 1767    "张三1767"
0000000039E7    000000005100    F80000019D0110  student 1768    "张三1768"
0000000039E8    000000005101    F90000019E0110  student 1769    "张三1769"
0000000039E9    000000005102    FA0000019F0110  student 1770    "张三1770"
0000000039EA    000000005103    FB000001A00110  student 1771    "张三1771"
0000000039EB    000000005104    FC000001A10110  student 1772    "张三1772"
0000000039EC    000000005105    FD000001A20110  student 1773    "张三1773"
0000000039ED    000000005106    FE000001A30110  student 1774    "张三1774"
0000000039EE    000000005107    FF000001A40110  student 1775    "张三1775"
0000000039EF    000000005108    800000010D0110  student 1776    "张三1776"
0000000039F0    000000005109    A1000001120110  student 1777    "张三1777"

数据导入

[root@localhost tmp]# scp student.sql root@10.138.130.250:/
The authenticity of host '10.138.130.250 (10.138.130.250)' can't be established.
ECDSA key fingerprint is 7f:1f:9a:0f:8b:d1:e0:17:32:08:12:73:d8:1d:9c:da.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.138.130.250' (ECDSA) to the list of known hosts.
root@10.138.130.250's password:
student.sql                                                                                                                                                                                              100%  116     0.1KB/s   00:00
[root@localhost tmp]# scp /undrop-for-innodb-master/dumps/default/student* root@10.138.130.250:/
root@10.138.130.250's password:
student                                                                                                                                                                                                  100% 1699KB   1.7MB/s   00:00
student.sql                                                                                                                                                                                              100%  235     0.2KB/s   00:00
[root@localhost tmp]#
mysql> source /mysqldata/student.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 25828 rows affected (0.28 sec)
Records: 25828  Deleted: 0  Skipped: 0  Warnings: 0

mysql> select count(*) from student;
+----------+
| count(*) |
+----------+
|    25828 |
+----------+
1 row in set (0.01 sec)

比损坏之前多了一万多条记录。

mysql> select count(distinct stu_id,stu_name) from student;
+---------------------------------+
| count(distinct stu_id,stu_name) |
+---------------------------------+
|                           10000 |
+---------------------------------+
1 row in set (0.03 sec)

mysql> select * from student where stu_id=1;
+--------+----------+
| stu_id | stu_name |
+--------+----------+
|      1 | 张三1    |
+--------+----------+
1 row in set (0.02 sec)

mysql> select * from student where stu_id=2;
+--------+----------+
| stu_id | stu_name |
+--------+----------+
|      2 | 张三2    |
+--------+----------+
1 row in set (0.01 sec)

mysql> select * from student where stu_id=100;
+--------+-----------+
| stu_id | stu_name  |
+--------+-----------+
|    100 | 张三100   |
+--------+-----------+
1 row in set (0.02 sec)

mysql> select * from student where stu_id=1800;
+--------+------------+
| stu_id | stu_name   |
+--------+------------+
|   1800 | 张三1800   |
|   1800 | 张三1800   |
+--------+------------+
2 rows in set (0.02 sec)

也就是标记为损坏的数据块所存储的记录在解析时出现了重复。将重复记录删除掉就可以恢复到损坏状态。

MySQL数据文件被删除后不能正常启动的恢复

数据文件被删除后的恢复
常规情况下如数据库出现坏块,如果数据库出现极端情况导致innodb_force_recovery=6,无法恢复,需要直接读取ibd 文件数据进行恢复,因此整体的恢复思路是把数据从ibd 读取出来,恢复到另外一个实例中

1.创建测试表

mysql> create table student(stu_id int(12),stu_name varchar(20));
Query OK, 0 rows affected (0.06 sec)
mysql> DELIMITER $
mysql> CREATE PROCEDURE proc_initData()
    -> BEGIN
    ->     DECLARE i INT DEFAULT 1;
    ->     WHILE i< =10000 DO
    ->         INSERT INTO student (stu_id,stu_name) VALUES(i,concat("张三",i));
    ->         SET i = i+1;
    ->     END WHILE;
    -> END $
Query OK, 0 rows affected (0.01 sec)

mysql> DELIMITER ;
mysql> CALL proc_initData();
Query OK, 1 row affected (4 min 3.81 sec)

mysql> commit;
Query OK, 0 rows affected (0.00 sec)

mysql> select count(*) from student;
+----------+
| count(*) |
+----------+
|    10000 |
+----------+
1 row in set (0.01 sec)

2.将数据文件student.ibd模拟损坏其中一个数据块

[root@localhost test]# dd if=/dev/zero of=/mysqldata/mysql/test/student.ibd bs=16384 skip=2 count=1
1+0 records in
1+0 records out
16384 bytes (16 kB) copied, 0.00080267 s, 20.4 MB/s

[root@localhost undrop-for-innodb-master]# service mysqld start
Starting MySQL.. ERROR! The server quit without updating PID file (/mysqldata/mysql/mysqld.pid).

2024-03-15T07:53:59.455587Z 0 [ERROR] InnoDB: The size of tablespace file ./test/student.ibd is only 16384, should be at least 65536!
2024-03-15 15:53:59 0x7f53857fa700  InnoDB: Assertion failure in thread 139996698748672 in file fil0fil.cc line 793

3.设置恢复参数innodb_force_recovery
设置innodb_force_recovery=1-6分别尝试启动mysql服务。

[root@localhost undrop-for-innodb-master]# service mysqld start
Starting MySQL.. SUCCESS!
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| intable        |
| iuser          |
| student        |
| t2             |
+----------------+
4 rows in set (0.01 sec)

mysql> drop table student;
ERROR 1051 (42S02): Unknown table 'test.student'

4.在其它mysql实例中创建一个同名的表并将表的frm文件拷贝到被意外删除表相关文件的目录下后再执行删除

mysql> drop table student;
Query OK, 0 rows affected (0.16 sec)

2024-03-15T08:27:07.906624Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2024-03-15T08:27:07.906835Z 0 [Note] /mysqlsoft/mysql/bin/mysqld (mysqld 5.7.26-log) starting as process 3036 ...
2024-03-15T08:27:07.916535Z 0 [Note] InnoDB: PUNCH HOLE support available
2024-03-15T08:27:07.916618Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2024-03-15T08:27:07.916719Z 0 [Note] InnoDB: Uses event mutexes
2024-03-15T08:27:07.916771Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2024-03-15T08:27:07.916831Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2024-03-15T08:27:07.917573Z 0 [Note] InnoDB: Number of pools: 1
2024-03-15T08:27:07.917926Z 0 [Note] InnoDB: Using CPU crc32 instructions
2024-03-15T08:27:07.922739Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2024-03-15T08:27:07.939838Z 0 [Note] InnoDB: Completed initialization of buffer pool
2024-03-15T08:27:07.945196Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2024-03-15T08:27:07.987840Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2024-03-15T08:27:08.275126Z 0 [ERROR] InnoDB: Operating system error number 2 in a file operation.
2024-03-15T08:27:08.275233Z 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2024-03-15T08:27:08.275297Z 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2024-03-15T08:27:08.275331Z 0 [ERROR] InnoDB: Cannot open datafile for read-only: './test/student.ibd' OS error: 71
2024-03-15T08:27:08.275371Z 0 [ERROR] InnoDB: Operating system error number 2 in a file operation.
2024-03-15T08:27:08.275422Z 0 [ERROR] InnoDB: The error means the system cannot find the path specified.
2024-03-15T08:27:08.275450Z 0 [ERROR] InnoDB: If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2024-03-15T08:27:08.275481Z 0 [ERROR] InnoDB: Could not find a valid tablespace file for `test/student`. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2024-03-15T08:27:08.275521Z 0 [Warning] InnoDB: Ignoring tablespace `test/student` because it could not be opened.
2024-03-15T08:27:08.277095Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2024-03-15T08:27:08.277447Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2024-03-15T08:27:08.411733Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2024-03-15T08:27:08.414031Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2024-03-15T08:27:08.414082Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2024-03-15T08:27:08.414841Z 0 [Note] InnoDB: Waiting for purge to start
2024-03-15T08:27:08.465455Z 0 [Note] InnoDB: 5.7.26 started; log sequence number 6008194
2024-03-15T08:27:08.465540Z 0 [Note] InnoDB: !!! innodb_force_recovery is set to 1 !!!
2024-03-15T08:27:08.465938Z 0 [Note] InnoDB: Loading buffer pool(s) from /mysqldata/mysql/ib_buffer_pool
2024-03-15T08:27:08.466538Z 0 [Note] Plugin 'FEDERATED' is disabled.
2024-03-15T08:27:08.485021Z 0 [Note] InnoDB: Buffer pool(s) load completed at 240315 16:27:08
2024-03-15T08:27:08.555227Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2024-03-15T08:27:08.556469Z 0 [Warning] CA certificate ca.pem is self signed.
2024-03-15T08:27:08.559933Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2024-03-15T08:27:08.560137Z 0 [Note] IPv6 is available.
2024-03-15T08:27:08.560258Z 0 [Note]   - '::' resolves to '::';
2024-03-15T08:27:08.560370Z 0 [Note] Server socket created on IP: '::'.
2024-03-15T08:27:08.632833Z 0 [Note] Failed to start slave threads for channel ''
2024-03-15T08:27:08.652361Z 0 [Note] Event Scheduler: Loaded 0 events
2024-03-15T08:27:08.652743Z 0 [Note] /mysqlsoft/mysql/bin/mysqld: ready for connections.
Version: '5.7.26-log'  socket: '/mysqlsoft/mysql/mysql.sock'  port: 3306  Source distribution
2024-03-15T08:27:24.889709Z 2 [ERROR] Invalid (old?) table or database name 'mysql-keyring'
2024-03-15T08:36:28.778461Z 2 [ERROR] InnoDB: Failed to find tablespace for table `test`.`student` in the cache. Attempting to load the tablespace with space id 45
2024-03-15T08:36:28.789158Z 2 [ERROR] InnoDB: In file './test/student.ibd', tablespace id and flags are 47 and 33, but in the InnoDB data dictionary they are 45 and 33. Have you moved InnoDB .ibd files around without using the commands DISCARD TABLESPACE and IMPORT TABLESPACE? Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html for how to resolve the issue.
2024-03-15T08:36:28.789251Z 2 [ERROR] InnoDB: Operating system error number 2 in a file operation.
2024-03-15T08:36:28.789297Z 2 [ERROR] InnoDB: The error means the system cannot find the path specified.
2024-03-15T08:36:28.789365Z 2 [ERROR] InnoDB: Could not find a valid tablespace file for `test/student`. Please refer to http://dev.mysql.com/doc/refman/5.7/en/innodb-troubleshooting-datadict.html for how to resolve the issue.

MySQL Innodb 数据文件头损坏的恢复

一.数据头损坏
1:观察日志
数据库启动失败,同时查看日志文件中出现头文件校验时出现报错

[root@localhost soft]# service mysqld start

从日志文件可以看到mysql启动失败了,因为Space ID in fsp header is 39, but in the page header it is 38.

2024-03-11T07:32:33.414216Z 0 [ERROR] InnoDB: Space ID in fsp header is 39, but in the page header it is 38.
2024-03-11T07:32:33.414356Z 0 [ERROR] [FATAL] InnoDB: Tablespace id is 38 in the data dictionary but in file ./test/iuser.ibd it is 18446744073709551615!
2024-03-11 15:32:33 0x7efc05ffb700  InnoDB: Assertion failure in thread 139620897502976 in file ut0ut.cc line 942
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
07:32:33 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

key_buffer_size=8388608
read_buffer_size=131072
max_used_connections=0
max_threads=151
thread_count=0
connection_count=0
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68196 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0 thread_stack 0x40000
/mysqlsoft/mysql/bin/mysqld(my_print_stacktrace+0x2c)[0xebd4ec]
/mysqlsoft/mysql/bin/mysqld(handle_fatal_signal+0x451)[0x7aa371]
/lib64/libpthread.so.0(+0xf130)[0x7efc4d9e7130]
/lib64/libc.so.6(gsignal+0x37)[0x7efc4c7ec5d7]
/lib64/libc.so.6(abort+0x148)[0x7efc4c7edcc8]
/mysqlsoft/mysql/bin/mysqld[0x77a965]
/mysqlsoft/mysql/bin/mysqld(_ZN2ib5fatalD1Ev+0x4d)[0x108763d]
/mysqlsoft/mysql/bin/mysqld[0x1136bf3]
/mysqlsoft/mysql/bin/mysqld[0x113727a]
/mysqlsoft/mysql/bin/mysqld(_Z6fil_ioRK9IORequestbRK9page_id_tRK11page_size_tmmPvS8_+0x262)[0x1141cc2]
/mysqlsoft/mysql/bin/mysqld[0x10f215a]
/mysqlsoft/mysql/bin/mysqld(_Z24buf_read_page_backgroundRK9page_id_tRK11page_size_tb+0x2b)[0x10f400b]
/mysqlsoft/mysql/bin/mysqld[0x10d7de5]
/mysqlsoft/mysql/bin/mysqld(buf_dump_thread+0x121)[0x10d8371]
/lib64/libpthread.so.0(+0x7df5)[0x7efc4d9dfdf5]
/lib64/libc.so.6(clone+0x6d)[0x7efc4c8ad60d]
The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
information that should help you find out what is causing the crash.

2:space id 说明
正常情况下Space ID 在fsp header 和page header 是一样的。Space id 在所有的页块中中都有存在。其中fsp header(file space header)占用的空间为(数据文件的第一个块的38-150 字节)。page header 占用的空间为每个块固有的前38 字节。而space id 在fsp header 中为38-41,在page header 为34-37.

3:查找正确的space id 值.
由于是某个页头损坏,space id 不正确,而space id 在每个页中都存在,只需要确认绝大部分的页头的的space id 为多少即可。可以看到页头space id 为00000026(16 进制),换成10 进制为38,也就是38 是正确的数字space id。

[root@localhost soft]# ./bcview /mysqldata/mysql/test/iuser.ibd 16 34 4
******************************************************************
This Tool Is Uesed For Find The Data In Binary format(Hexadecimal)
Usage:./bcview file blocksize offset cnt-bytes!
file: Is Your File Will To Find Data!
blocksize: Is N kb Block.Eg: 8 Is 8 Kb Blocksize(Oracle)!
                         Eg: 16 Is 16 Kb Blocksize(Innodb)!
offset:Is Every Block Offset Your Want Start!
cnt-bytes:Is After Offset,How Bytes Your Want Gets!
Edtor QQ:22389860!
Used gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
******************************************************************
----Current file size is :0.093750 Mb
----Current use set blockszie is 16 Kb
----Current file name is /mysqldata/mysql/test/iuser.ibd
current block:00000000--Offset:00034--cnt bytes:04--data is:00000026
current block:00000001--Offset:00034--cnt bytes:04--data is:00000026
current block:00000002--Offset:00034--cnt bytes:04--data is:00000026
current block:00000003--Offset:00034--cnt bytes:04--data is:00000026
current block:00000004--Offset:00034--cnt bytes:04--data is:00000000
current block:00000005--Offset:00034--cnt bytes:04--data is:00000000

4:查看fsp header 中的space id
由于fsp header 只存在第一个块中38-150,而space id 又存在与38-41 中,因此需要查看第一个块中偏移量为38 开始的后4 个字节内容根据脚本可以查看到具体的为00000027(10 进制为39)

[root@localhost soft]#  ./bcview /mysqldata/mysql/test/iuser.ibd 16 38 4
******************************************************************
This Tool Is Uesed For Find The Data In Binary format(Hexadecimal)
Usage:./bcview file blocksize offset cnt-bytes!
file: Is Your File Will To Find Data!
blocksize: Is N kb Block.Eg: 8 Is 8 Kb Blocksize(Oracle)!
                         Eg: 16 Is 16 Kb Blocksize(Innodb)!
offset:Is Every Block Offset Your Want Start!
cnt-bytes:Is After Offset,How Bytes Your Want Gets!
Edtor QQ:22389860!
Used gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
******************************************************************
----Current file size is :0.093750 Mb
----Current use set blockszie is 16 Kb
----Current file name is /mysqldata/mysql/test/iuser.ibd
current block:00000000--Offset:00038--cnt bytes:04--data is:00000027
current block:00000001--Offset:00038--cnt bytes:04--data is:00000000
current block:00000002--Offset:00038--cnt bytes:04--data is:ffffffff
current block:00000003--Offset:00038--cnt bytes:04--data is:000200d9
current block:00000004--Offset:00038--cnt bytes:04--data is:00000000
current block:00000005--Offset:00038--cnt bytes:04--data is:00000000

5:修改fsb header 中的space id

[root@localhost soft]# ./bctool /mysqldata/mysql/test/iuser.ibd 0 38 00000026
******************************************************************
This tool is uesed to check data ues binary format,no Big-Endian
or Little-Endian diff,this tool is base one byte on byte to change
!block is 16k.if want change other block eg:8k! please set blocks
0 and offset blocks*8192+offset!
usage:./bctool yfile blocks offset yourdata(XX)!
Warings:backup file frist!!!!!!!!!
Editor QQ:22389860
Ues gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
******************************************************************
0-0-0-26

再检查确认是否修改正确

[root@localhost soft]# ./bcview /mysqldata/mysql/test/iuser.ibd 16 38 4
******************************************************************
This Tool Is Uesed For Find The Data In Binary format(Hexadecimal)
Usage:./bcview file blocksize offset cnt-bytes!
file: Is Your File Will To Find Data!
blocksize: Is N kb Block.Eg: 8 Is 8 Kb Blocksize(Oracle)!
                         Eg: 16 Is 16 Kb Blocksize(Innodb)!
offset:Is Every Block Offset Your Want Start!
cnt-bytes:Is After Offset,How Bytes Your Want Gets!
Edtor QQ:22389860!
Used gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
******************************************************************
----Current file size is :0.093750 Mb
----Current use set blockszie is 16 Kb
----Current file name is /mysqldata/mysql/test/iuser.ibd
current block:00000000--Offset:00038--cnt bytes:04--data is:00000026
current block:00000001--Offset:00038--cnt bytes:04--data is:00000000
current block:00000002--Offset:00038--cnt bytes:04--data is:ffffffff
current block:00000003--Offset:00038--cnt bytes:04--data is:000200d9
current block:00000004--Offset:00038--cnt bytes:04--data is:00000000
current block:00000005--Offset:00038--cnt bytes:04--data is:00000000

6:启动恢复

[root@localhost soft]# service mysqld start
Starting MySQL.. SUCCESS!

2024-03-11T08:11:11.170599Z 0 [Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
2024-03-11T08:11:11.170822Z 0 [Note] /mysqlsoft/mysql/bin/mysqld (mysqld 5.7.26-log) starting as process 14764 ...
2024-03-11T08:11:11.181460Z 0 [Note] InnoDB: PUNCH HOLE support available
2024-03-11T08:11:11.181548Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2024-03-11T08:11:11.181574Z 0 [Note] InnoDB: Uses event mutexes
2024-03-11T08:11:11.181591Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2024-03-11T08:11:11.181622Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2024-03-11T08:11:11.182346Z 0 [Note] InnoDB: Number of pools: 1
2024-03-11T08:11:11.182638Z 0 [Note] InnoDB: Using CPU crc32 instructions
2024-03-11T08:11:11.187180Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2024-03-11T08:11:11.204123Z 0 [Note] InnoDB: Completed initialization of buffer pool
2024-03-11T08:11:11.209837Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2024-03-11T08:11:11.251385Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2024-03-11T08:11:11.471672Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2024-03-11T08:11:11.471768Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2024-03-11T08:11:11.472040Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2024-03-11T08:11:11.570867Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2024-03-11T08:11:11.572707Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2024-03-11T08:11:11.572759Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2024-03-11T08:11:11.574109Z 0 [Note] InnoDB: Waiting for purge to start
2024-03-11T08:11:11.624691Z 0 [Note] InnoDB: 5.7.26 started; log sequence number 2950883
2024-03-11T08:11:11.626078Z 0 [Note] InnoDB: Loading buffer pool(s) from /mysqldata/mysql/ib_buffer_pool
2024-03-11T08:11:11.626717Z 0 [Note] Plugin 'FEDERATED' is disabled.
2024-03-11T08:11:11.649744Z 0 [Note] Recovering after a crash using /mysqldata/mysql/binlog
2024-03-11T08:11:11.649798Z 0 [Note] Starting crash recovery...
2024-03-11T08:11:11.649921Z 0 [Note] Crash recovery finished.
2024-03-11T08:11:11.736054Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2024-03-11T08:11:11.737385Z 0 [Warning] CA certificate ca.pem is self signed.
2024-03-11T08:11:11.740836Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2024-03-11T08:11:11.743232Z 0 [Note] IPv6 is available.
2024-03-11T08:11:11.743360Z 0 [Note]   - '::' resolves to '::';
2024-03-11T08:11:11.743427Z 0 [Note] Server socket created on IP: '::'.
2024-03-11T08:11:11.790698Z 0 [Note] Failed to start slave threads for channel ''
2024-03-11T08:11:11.811031Z 0 [Note] Event Scheduler: Loaded 0 events
2024-03-11T08:11:11.811400Z 0 [Note] /mysqlsoft/mysql/bin/mysqld: ready for connections.
Version: '5.7.26-log'  socket: '/mysqlsoft/mysql/mysql.sock'  port: 3306  Source distribution
2024-03-11T08:11:11.818280Z 0 [Note] InnoDB: Buffer pool(s) load completed at 240311 16:11:11

oracle使用rman对启用归档的rac 11g数据库执行备份与恢复操作(异机恢复)

因为要被审计的数据库有10T大小,用逻辑导出导入方式复制一份数据用于审计满足不了时间要求,而且生产环境没有空间用于执行逻辑备份或物理备份,所以执行rman物理备份时只能通过nfs将备份文件直接存储在目标主机上。但我这里的测试还是在生产环境中执行rman备份,这个只是测试可行性。下面是将生产库通过rman备份在异机上执行恢复的具体步骤:
1.对源库执行全库备份脚本

vi backup.sh
backtime=`date +"20%y%m%d%H%M%S"`
rman target /  log=/rmanbak/dadb_backupall_$backtime.log < 

2.执行备份脚本对源库执行备份

[oracle@dbs1 rmanbak]$ ./jy.sh

RMAN> 2> 3> 4> 5> 6> 7> 8> 9> 10> 11> 12> 13> 14>
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=3694 instance=dadb1 device type=DISK

allocated channel: c2
channel c2: SID=1849 instance=dadb1 device type=DISK

Starting backup at 06-MAR-24
channel c1: starting compressed full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00002 name=+DA/dadbp/datafile/sysaux.260.1109022421
input datafile file number=00007 name=+DA/dadbp/datafile/system001.dbf
input datafile file number=00010 name=+DA/dadbp/datafile/test.288.1109026503
input datafile file number=00004 name=+DA/dadbp/datafile/users.267.1109022873
input datafile file number=00006 name=+DA/dadbp/datafile/hygeia.261.1109022717
channel c1: starting piece 1 at 06-MAR-24
channel c2: starting compressed full datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00008 name=+DA/dadbp/datafile/sysaux.259.1109022127
input datafile file number=00001 name=+DA/dadbp/datafile/system.263.1109022847
input datafile file number=00005 name=+DA/dadbp/datafile/undotbs2.264.1109022863
input datafile file number=00003 name=+DA/dadbp/datafile/undotbs1.265.1109022869
input datafile file number=00009 name=+DA/dadbp/datafile/cs01.bdf
channel c2: starting piece 1 at 06-MAR-24
channel c2: finished piece 1 at 06-MAR-24
piece handle=/rmanbak/dadb_DADB_20240306_vv2l0hog_1_1 tag=DA_FULL_BAK comment=NONE
channel c2: backup set complete, elapsed time: 00:14:35
channel c2: starting compressed full datafile backup set
channel c2: specifying datafile(s) in backup set
including current control file in backup set
channel c2: starting piece 1 at 06-MAR-24
channel c2: finished piece 1 at 06-MAR-24
piece handle=/rmanbak/dadb_DADB_20240306_002l0ijr_1_1 tag=DA_FULL_BAK comment=NONE
channel c2: backup set complete, elapsed time: 00:00:03
channel c2: starting compressed full datafile backup set
channel c2: specifying datafile(s) in backup set
including current SPFILE in backup set
channel c2: starting piece 1 at 06-MAR-24
channel c2: finished piece 1 at 06-MAR-24
piece handle=/rmanbak/dadb_DADB_20240306_012l0ijv_1_1 tag=DA_FULL_BAK comment=NONE
channel c2: backup set complete, elapsed time: 00:00:01
channel c1: finished piece 1 at 06-MAR-24
piece handle=/rmanbak/dadb_DADB_20240306_vu2l0hog_1_1 tag=DA_FULL_BAK comment=NONE
channel c1: backup set complete, elapsed time: 00:18:24
Finished backup at 06-MAR-24

sql statement: alter system archive log current

Starting backup at 06-MAR-24
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=36171 RECID=12088 STAMP=1162596765
input archived log thread=2 sequence=27786 RECID=12094 STAMP=1162628068
input archived log thread=1 sequence=36172 RECID=12090 STAMP=1162625683
input archived log thread=1 sequence=36173 RECID=12092 STAMP=1162628067
input archived log thread=1 sequence=36174 RECID=12096 STAMP=1162645216
input archived log thread=2 sequence=27787 RECID=12098 STAMP=1162663210
input archived log thread=1 sequence=36175 RECID=12101 STAMP=1162679311
input archived log thread=2 sequence=27788 RECID=12102 STAMP=1162679311
input archived log thread=1 sequence=36176 RECID=12104 STAMP=1162679313
input archived log thread=2 sequence=27789 RECID=12106 STAMP=1162679314
input archived log thread=1 sequence=36177 RECID=12108 STAMP=1162683167
input archived log thread=2 sequence=27790 RECID=12114 STAMP=1162714548
input archived log thread=1 sequence=36178 RECID=12110 STAMP=1162713627
input archived log thread=1 sequence=36179 RECID=12112 STAMP=1162714545
input archived log thread=1 sequence=36180 RECID=12116 STAMP=1162750588
input archived log thread=2 sequence=27791 RECID=12120 STAMP=1162765758
channel c1: starting piece 1 at 06-MAR-24
channel c2: starting archived log backup set
channel c2: specifying archived log(s) in backup set
input archived log thread=1 sequence=36181 RECID=12118 STAMP=1162765756
input archived log thread=1 sequence=36182 RECID=12124 STAMP=1162765763
input archived log thread=2 sequence=27792 RECID=12122 STAMP=1162765761
input archived log thread=2 sequence=27793 RECID=12130 STAMP=1162800019
input archived log thread=1 sequence=36183 RECID=12126 STAMP=1162769575
input archived log thread=1 sequence=36184 RECID=12128 STAMP=1162800017
input archived log thread=1 sequence=36185 RECID=12132 STAMP=1162801020
input archived log thread=2 sequence=27794 RECID=12136 STAMP=1162850453
input archived log thread=1 sequence=36186 RECID=12134 STAMP=1162846806
input archived log thread=1 sequence=36187 RECID=12138 STAMP=1162852076
input archived log thread=2 sequence=27795 RECID=12140 STAMP=1162852078
input archived log thread=1 sequence=36188 RECID=12144 STAMP=1162852082
input archived log thread=2 sequence=27796 RECID=12142 STAMP=1162852080
input archived log thread=2 sequence=27797 RECID=12150 STAMP=1162887460
input archived log thread=1 sequence=36189 RECID=12146 STAMP=1162855991
input archived log thread=1 sequence=36190 RECID=12148 STAMP=1162887457
input archived log thread=1 sequence=36191 RECID=12154 STAMP=1162890083
input archived log thread=2 sequence=27798 RECID=12152 STAMP=1162890082
channel c2: starting piece 1 at 06-MAR-24
channel c1: finished piece 1 at 06-MAR-24
piece handle=/rmanbak/dadb_arc_1162890092_21506 tag=DA_ARC_BAK comment=NONE
channel c1: backup set complete, elapsed time: 00:00:15
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=2 sequence=27799 RECID=12158 STAMP=1162890088
input archived log thread=1 sequence=36192 RECID=12156 STAMP=1162890086
channel c1: starting piece 1 at 06-MAR-24
channel c2: finished piece 1 at 06-MAR-24
piece handle=/rmanbak/dadb_arc_1162890092_21507 tag=DA_ARC_BAK comment=NONE
channel c2: backup set complete, elapsed time: 00:00:15
channel c1: finished piece 1 at 06-MAR-24
piece handle=/rmanbak/dadb_arc_1162890107_21508 tag=DA_ARC_BAK comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 06-MAR-24

Starting backup at 06-MAR-24
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current control file in backup set
channel c1: starting piece 1 at 06-MAR-24
channel c1: finished piece 1 at 06-MAR-24
piece handle=/rmanbak/dadb_cntrl_21509_1_21509 tag=DA_CONTROL_BAK comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 06-MAR-24

validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_02/thread_1_seq_36171.938.1162596765 RECID=12088 STAMP=1162596765
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_03/thread_1_seq_36172.317.1162625683 RECID=12090 STAMP=1162625683
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_03/thread_1_seq_36173.2388.1162628067 RECID=12092 STAMP=1162628067
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_03/thread_1_seq_36174.1976.1162645215 RECID=12096 STAMP=1162645216
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_03/thread_1_seq_36175.370.1162679311 RECID=12101 STAMP=1162679311
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_03/thread_1_seq_36176.962.1162679313 RECID=12104 STAMP=1162679313
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_03/thread_1_seq_36177.2719.1162683167 RECID=12108 STAMP=1162683167
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_04/thread_1_seq_36178.2575.1162713627 RECID=12110 STAMP=1162713627
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_04/thread_1_seq_36179.2282.1162714545 RECID=12112 STAMP=1162714545
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_04/thread_1_seq_36180.1884.1162750589 RECID=12116 STAMP=1162750588
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_04/thread_1_seq_36181.973.1162765757 RECID=12118 STAMP=1162765756
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_04/thread_1_seq_36182.2148.1162765763 RECID=12124 STAMP=1162765763
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_04/thread_1_seq_36183.1132.1162769575 RECID=12126 STAMP=1162769575
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_05/thread_1_seq_36184.2397.1162800017 RECID=12128 STAMP=1162800017
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_05/thread_1_seq_36185.1359.1162801021 RECID=12132 STAMP=1162801020
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_05/thread_1_seq_36186.2488.1162846805 RECID=12134 STAMP=1162846806
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_05/thread_1_seq_36187.2068.1162852077 RECID=12138 STAMP=1162852076
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_05/thread_1_seq_36188.2513.1162852083 RECID=12144 STAMP=1162852082
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_05/thread_1_seq_36189.2592.1162855991 RECID=12146 STAMP=1162855991
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_06/thread_1_seq_36190.287.1162887457 RECID=12148 STAMP=1162887457
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_06/thread_1_seq_36191.2276.1162890083 RECID=12154 STAMP=1162890083
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_06/thread_1_seq_36192.1168.1162890087 RECID=12156 STAMP=1162890086
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_03/thread_2_seq_27786.2448.1162628069 RECID=12094 STAMP=1162628068
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_03/thread_2_seq_27787.1182.1162663211 RECID=12098 STAMP=1162663210
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_03/thread_2_seq_27788.567.1162679311 RECID=12102 STAMP=1162679311
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_03/thread_2_seq_27789.2305.1162679315 RECID=12106 STAMP=1162679314
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_04/thread_2_seq_27790.2769.1162714549 RECID=12114 STAMP=1162714548
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_04/thread_2_seq_27791.2742.1162765757 RECID=12120 STAMP=1162765758
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_04/thread_2_seq_27792.1811.1162765761 RECID=12122 STAMP=1162765761
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_05/thread_2_seq_27793.1189.1162800019 RECID=12130 STAMP=1162800019
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_05/thread_2_seq_27794.1140.1162850449 RECID=12136 STAMP=1162850453
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_05/thread_2_seq_27795.2058.1162852077 RECID=12140 STAMP=1162852078
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_05/thread_2_seq_27796.2345.1162852081 RECID=12142 STAMP=1162852080
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_06/thread_2_seq_27797.1391.1162887461 RECID=12150 STAMP=1162887460
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_06/thread_2_seq_27798.2100.1162890083 RECID=12152 STAMP=1162890082
validation succeeded for archived log
archived log file name=+ARCH/dadbp/archivelog/2024_03_06/thread_2_seq_27799.2212.1162890089 RECID=12158 STAMP=1162890088
Crosschecked 36 objects


crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/db_DADB_20240303_v62kq4gm_1_1 RECID=21314 STAMP=1162678806
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/db_DADB_20240303_v72kq4uk_1_1 RECID=21315 STAMP=1162679259
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/db_DADB_20240303_v52kq4gm_1_1 RECID=21317 STAMP=1162678806
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/arc_1162679319_21482 RECID=21318 STAMP=1162679319
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/arc_1162679319_21481 RECID=21319 STAMP=1162679319
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/arc_1162679326_21483 RECID=21320 STAMP=1162679326
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/cntrl_21484_1_21484 RECID=21321 STAMP=1162679331
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/db_DADB_20240304_ve2ksoso_1_1 RECID=21322 STAMP=1162765208
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/db_DADB_20240304_vf2kspbt_1_1 RECID=21323 STAMP=1162765719
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/db_DADB_20240304_vg2kspco_1_1 RECID=21324 STAMP=1162765720
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/db_DADB_20240304_vd2ksoso_1_1 RECID=21325 STAMP=1162765208
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/arc_1162765766_21490 RECID=21326 STAMP=1162765767
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/arc_1162765766_21489 RECID=21327 STAMP=1162765766
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/cntrl_21491_1_21491 RECID=21328 STAMP=1162765777
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/db_DADB_20240305_vl2kvd8m_1_1 RECID=21329 STAMP=1162851606
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/db_DADB_20240305_vm2kvdll_1_1 RECID=21330 STAMP=1162852028
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/db_DADB_20240305_vn2kvdlt_1_1 RECID=21331 STAMP=1162852029
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/db_DADB_20240305_vk2kvd8m_1_1 RECID=21332 STAMP=1162851606
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/arc_1162852086_21496 RECID=21333 STAMP=1162852086
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/arc_1162852086_21497 RECID=21334 STAMP=1162852086
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/arc_1162852093_21498 RECID=21335 STAMP=1162852093
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dangan/cntrl_21499_1_21499 RECID=21336 STAMP=1162852098
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dadb_DADB_20240306_vv2l0hog_1_1 RECID=21337 STAMP=1162888976
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dadb_DADB_20240306_002l0ijr_1_1 RECID=21338 STAMP=1162889852
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dadb_DADB_20240306_012l0ijv_1_1 RECID=21339 STAMP=1162889855
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dadb_DADB_20240306_vu2l0hog_1_1 RECID=21340 STAMP=1162888976
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dadb_arc_1162890092_21506 RECID=21341 STAMP=1162890092
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dadb_arc_1162890092_21507 RECID=21342 STAMP=1162890092
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dadb_arc_1162890107_21508 RECID=21343 STAMP=1162890107
crosschecked backup piece: found to be 'AVAILABLE'
backup piece handle=/rmanbak/dadb_cntrl_21509_1_21509 RECID=21344 STAMP=1162890110
Crosschecked 30 objects


specification does not match any backup in the repository

RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 7 days
no obsolete backups found

released channel: c1

released channel: c2

RMAN>

Recovery Manager complete.

3.将备份文件拷贝到目标主机上

[root@dbs1 rmanbak]# scp dadb*  10.18.10.101:/databak/dadb/
root@10.18.10.101's password:
dadb_arc_1162890092_21506                                                                                                                                                                                100%  970MB  88.2MB/s   00:11
dadb_arc_1162890092_21507                                                                                                                                                                                100%  854MB  85.4MB/s   00:10
dadb_arc_1162890107_21508                                                                                                                                                                                100%   20KB  20.0KB/s   00:00
dadb_backupall_20240306084252.log                                                                                                                                                                        100%   17KB  16.7KB/s   00:00
dadb_cntrl_21509_1_21509                                                                                                                                                                                 100%   85MB  85.4MB/s   00:00
dadb_DADB_20240306_002l0ijr_1_1                                                                                                                                                                          100% 5344KB   5.2MB/s   00:01
dadb_DADB_20240306_012l0ijv_1_1                                                                                                                                                                          100%   96KB  96.0KB/s   00:00
dadb_DADB_20240306_vu2l0hog_1_1                                                                                                                                                                          100% 5794MB  90.5MB/s   01:04
dadb_DADB_20240306_vv2l0hog_1_1                                                                                                                                                                          100% 4626MB  94.4MB/s   00:49
[root@dbs1 rmanbak]#

4.将源库的密码文件复制到目标主机上

[root@dbs1 rmanbak]# scp  /u01/app/oracle/product/11.2.0.4/db/dbs/orapwdadb1  10.18.10.101:/u01/app/oracle/product/11.2.0.4/db/dbs/
root@10.18.10.101's password:
orapwdadb1                                                                                                                                                                                               100% 1536     1.5KB/s   00:00
[root@dbs1 rmanbak]#

5.恢复初始化参数文件(这里需要找到包含初始化参数文件的备份集,在源端数据库可以通过list backup可以找到包含参数文件的备份集)

[oracle@sjjh dbs]$ rman target/

Recovery Manager: Release 11.2.0.4.0 - Production on Wed Mar 6 09:39:47 2024

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database (not started)

RMAN> startup nomount

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0.4/db/dbs/initdadb.ora'

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area    1068937216 bytes

Fixed Size                     2260088 bytes
Variable Size                327156616 bytes
Database Buffers             734003200 bytes
Redo Buffers                   5517312 bytes

RMAN> restore spfile to pfile '/u01/app/oracle/product/11.2.0.4/db/dbs/initdadb.ora' from '/databak/dadb/dadb_DADB_20240306_012l0ijv_1_1';

Starting restore at 06-MAR-24
using channel ORA_DISK_1

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /databak/dadb/dadb_DADB_20240306_012l0ijv_1_1
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 06-MAR-24

6.修改控制文件

[oracle@sjjh dbs]$ cat  initdadb.ora
dadb1.__db_cache_size=5133828096
dadb2.__db_cache_size=6442450944
dadb1.__java_pool_size=234881024
dadb2.__java_pool_size=234881024
dadb1.__large_pool_size=268435456
dadb2.__large_pool_size=268435456
dadb1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
dadb1.__pga_aggregate_target=5368709120
dadb2.__pga_aggregate_target=5368709120
dadb1.__sga_target=10737418240
dadb2.__sga_target=10737418240
dadb1.__shared_io_pool_size=536870912
dadb2.__shared_io_pool_size=0
dadb1.__shared_pool_size=4429185024
dadb2.__shared_pool_size=3724541952
dadb1.__streams_pool_size=67108864
dadb2.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/dadb/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/oradata/dadb/controlfile/control01.ctl','/oradata/dadb/controlfile/control02.ctl'
*.db_block_size=8192
*.db_create_file_dest='/oradata/dadb'
*.db_domain=''
*.db_file_name_convert='+da/dadbs/','/oradata/dadb/'
*.db_name='dadb'
*.db_unique_name='dadbp'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=dadbXDB)'
dadb2.instance_number=2
dadb1.instance_number=1
*.log_archive_dest_1='location=/oradata/arch  valid_for=(all_logfiles,all_roles) db_unique_name=dadb'
*.log_archive_dest_2=''
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='enable'
*.log_archive_format='%t_%s_%r.arch'
*.log_file_name_convert='+da/dadbs/','/oradata/dadb/'
*.open_cursors=300
*.pga_aggregate_target=5368709120
*.processes=3000
*.remote_login_passwordfile='exclusive'
*.service_names='dadb'
*.sessions=3305
*.sga_max_size=10737418240
*.sga_target=10737418240
dadb2.thread=2
dadb1.thread=1
dadb1.undo_tablespace='UNDOTBS1'
dadb2.undo_tablespace='UNDOTBS2'

[oracle@sjjh dbs]$ mkdir -p /u01/app/oracle/admin/dadb/adump

7.使用恢复的初始化参数文件nomount数据库

RMAN> shutdown immediate

Oracle instance shut down


RMAN> startup nomount pfile='/u01/app/oracle/product/11.2.0.4/db/dbs/initdadb.ora'

Oracle instance started

Total System Global Area   10689474560 bytes

Fixed Size                     2262656 bytes
Variable Size               2785020288 bytes
Database Buffers            7885291520 bytes
Redo Buffers                  16900096 bytes

8.恢复控制文件

RMAN> restore controlfile from '/databak/dadb/dadb_DADB_20240306_002l0ijr_1_1';

Starting restore at 06-MAR-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1982 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:03
output file name=/oradata/dadb/controlfile/control01.ctl
output file name=/oradata/dadb/controlfile/control02.ctl
Finished restore at 06-MAR-24

9.启动数据库到mount状态

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

10.将备份集的信息加入到catalog,使目前的控制文件记录有目前的备份信息,以便用户恢复.从远端数据库拷贝过来的备份集存放于目录/databak/dadb/

RMAN> catalog start with '/databak/dadb/';

searching for all files that match the pattern /databak/dadb/

List of Files Unknown to the Database
=====================================
File Name: /databak/dadb/dadb_cntrl_21509_1_21509
File Name: /databak/dadb/dadb_DADB_20240306_vu2l0hog_1_1
File Name: /databak/dadb/dadb_DADB_20240306_002l0ijr_1_1
File Name: /databak/dadb/dadb_arc_1162890092_21506
File Name: /databak/dadb/dadb_DADB_20240306_012l0ijv_1_1
File Name: /databak/dadb/dadb_arc_1162890092_21507
File Name: /databak/dadb/dadb_arc_1162890107_21508
File Name: /databak/dadb/dadb_DADB_20240306_vv2l0hog_1_1

Do you really want to catalog the above files (enter YES or NO)? YES
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /databak/dadb/dadb_cntrl_21509_1_21509
File Name: /databak/dadb/dadb_DADB_20240306_vu2l0hog_1_1
File Name: /databak/dadb/dadb_DADB_20240306_002l0ijr_1_1
File Name: /databak/dadb/dadb_arc_1162890092_21506
File Name: /databak/dadb/dadb_DADB_20240306_012l0ijv_1_1
File Name: /databak/dadb/dadb_arc_1162890092_21507
File Name: /databak/dadb/dadb_arc_1162890107_21508
File Name: /databak/dadb/dadb_DADB_20240306_vv2l0hog_1_1

11.还原数据文件

RMAN> run{
2> allocate channel c1 device type disk;
3> allocate channel c2 device type disk;
4> set newname for datafile '+DA/dadbp/datafile/cs01.bdf' to '/oradata/dadb/cs01.dbf';
5> set newname for datafile '+DA/dadbp/datafile/hygeia.261.1109022717' to '/oradata/dadb/hygeia.dbf';
6> set newname for datafile '+DA/dadbp/datafile/sysaux.260.1109022421' to '/oradata/dadb/sysaux01.dbf';
7> set newname for datafile '+DA/dadbp/datafile/sysaux.259.1109022127' to '/oradata/dadb/sysaux.dbf';
8> set newname for datafile '+DA/dadbp/datafile/system.263.1109022847' to '/oradata/dadb/system.dbf';
9> set newname for datafile '+DA/dadbp/datafile/system001.dbf' to '/oradata/dadb/system001.dbf';
10> set newname for datafile '+DA/dadbp/datafile/test.288.1109026503' to '/oradata/dadb/test.dbf';
11> set newname for datafile '+DA/dadbp/datafile/undotbs1.265.1109022869' to '/oradata/dadb/undotbs1.dbf';
12> set newname for datafile '+DA/dadbp/datafile/undotbs2.264.1109022863' to '/oradata/dadb/undotbs2.dbf';
13> set newname for datafile '+DA/dadbp/datafile/users.267.1109022873' to '/oradata/dadb/users.dbf';
14> restore database;
15> switch datafile all;
16> release channel c1;
17> release channel c2;
18> }

released channel: ORA_DISK_1
allocated channel: c1
channel c1: SID=1982 device type=DISK

allocated channel: c2
channel c2: SID=2266 device type=DISK

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 06-MAR-24

channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00002 to /oradata/dadb/sysaux01.dbf
channel c1: restoring datafile 00004 to /oradata/dadb/users.dbf
channel c1: restoring datafile 00006 to /oradata/dadb/hygeia.dbf
channel c1: restoring datafile 00007 to /oradata/dadb/system001.dbf
channel c1: restoring datafile 00010 to /oradata/dadb/test.dbf
channel c1: reading from backup piece /databak/dadb/dadb_DADB_20240306_vu2l0hog_1_1
channel c2: starting datafile backup set restore
channel c2: specifying datafile(s) to restore from backup set
channel c2: restoring datafile 00001 to /oradata/dadb/system.dbf
channel c2: restoring datafile 00003 to /oradata/dadb/undotbs1.dbf
channel c2: restoring datafile 00005 to /oradata/dadb/undotbs2.dbf
channel c2: restoring datafile 00008 to /oradata/dadb/sysaux.dbf
channel c2: restoring datafile 00009 to /oradata/dadb/cs01.dbf
channel c2: reading from backup piece /databak/dadb/dadb_DADB_20240306_vv2l0hog_1_1
channel c2: piece handle=/databak/dadb/dadb_DADB_20240306_vv2l0hog_1_1 tag=DA_FULL_BAK
channel c2: restored backup piece 1
channel c2: restore complete, elapsed time: 00:20:26
channel c1: piece handle=/databak/dadb/dadb_DADB_20240306_vu2l0hog_1_1 tag=DA_FULL_BAK
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:25:36
Finished restore at 06-MAR-24


released channel: c1

released channel: c2

12.还原归档日志文件

RMAN> run{
2> allocate channel c1 device type disk;
3> allocate channel c2 device type disk;
4> set archivelog destination to '/oradata/arch/';
5> restore archivelog from logseq 36171 until logseq 36192 thread 1;
6> restore archivelog from logseq 27786 until logseq 27799 thread 2;
7> release channel c1;
8> release channel c2;
9> }

allocated channel: c1
channel c1: SID=1700 device type=DISK

allocated channel: c2
channel c2: SID=1982 device type=DISK

executing command: SET ARCHIVELOG DESTINATION

Starting restore at 06-MAR-24

channel c1: starting archived log restore to user-specified destination
archived log destination=/oradata/arch/
channel c1: restoring archived log
archived log thread=1 sequence=36171
channel c1: restoring archived log
archived log thread=1 sequence=36172
channel c1: restoring archived log
archived log thread=1 sequence=36173
channel c1: restoring archived log
archived log thread=1 sequence=36174
channel c1: restoring archived log
archived log thread=1 sequence=36175
channel c1: restoring archived log
archived log thread=1 sequence=36176
channel c1: restoring archived log
archived log thread=1 sequence=36177
channel c1: restoring archived log
archived log thread=1 sequence=36178
channel c1: restoring archived log
archived log thread=1 sequence=36179
channel c1: restoring archived log
archived log thread=1 sequence=36180
channel c1: reading from backup piece /databak/dadb/dadb_arc_1162890092_21506
channel c2: starting archived log restore to user-specified destination
archived log destination=/oradata/arch/
channel c2: restoring archived log
archived log thread=1 sequence=36181
channel c2: restoring archived log
archived log thread=1 sequence=36182
channel c2: restoring archived log
archived log thread=1 sequence=36183
channel c2: restoring archived log
archived log thread=1 sequence=36184
channel c2: restoring archived log
archived log thread=1 sequence=36185
channel c2: restoring archived log
archived log thread=1 sequence=36186
channel c2: restoring archived log
archived log thread=1 sequence=36187
channel c2: restoring archived log
archived log thread=1 sequence=36188
channel c2: restoring archived log
archived log thread=1 sequence=36189
channel c2: restoring archived log
archived log thread=1 sequence=36190
channel c2: restoring archived log
archived log thread=1 sequence=36191
channel c2: reading from backup piece /databak/dadb/dadb_arc_1162890092_21507
channel c2: piece handle=/databak/dadb/dadb_arc_1162890092_21507 tag=DA_ARC_BAK
channel c2: restored backup piece 1
channel c2: restore complete, elapsed time: 00:00:15
channel c2: starting archived log restore to user-specified destination
archived log destination=/oradata/arch/
channel c2: restoring archived log
archived log thread=1 sequence=36192
channel c2: reading from backup piece /databak/dadb/dadb_arc_1162890107_21508
channel c1: piece handle=/databak/dadb/dadb_arc_1162890092_21506 tag=DA_ARC_BAK
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:00:16
channel c2: piece handle=/databak/dadb/dadb_arc_1162890107_21508 tag=DA_ARC_BAK
channel c2: restored backup piece 1
channel c2: restore complete, elapsed time: 00:00:01
Finished restore at 06-MAR-24

Starting restore at 06-MAR-24

channel c1: starting archived log restore to user-specified destination
archived log destination=/oradata/arch/
channel c1: restoring archived log
archived log thread=2 sequence=27786
channel c1: restoring archived log
archived log thread=2 sequence=27787
channel c1: restoring archived log
archived log thread=2 sequence=27788
channel c1: restoring archived log
archived log thread=2 sequence=27789
channel c1: restoring archived log
archived log thread=2 sequence=27790
channel c1: restoring archived log
archived log thread=2 sequence=27791
channel c1: reading from backup piece /databak/dadb/dadb_arc_1162890092_21506
channel c2: starting archived log restore to user-specified destination
archived log destination=/oradata/arch/
channel c2: restoring archived log
archived log thread=2 sequence=27792
channel c2: restoring archived log
archived log thread=2 sequence=27793
channel c2: restoring archived log
archived log thread=2 sequence=27794
channel c2: restoring archived log
archived log thread=2 sequence=27795
channel c2: restoring archived log
archived log thread=2 sequence=27796
channel c2: restoring archived log
archived log thread=2 sequence=27797
channel c2: restoring archived log
archived log thread=2 sequence=27798
channel c2: reading from backup piece /databak/dadb/dadb_arc_1162890092_21507
channel c2: piece handle=/databak/dadb/dadb_arc_1162890092_21507 tag=DA_ARC_BAK
channel c2: restored backup piece 1
channel c2: restore complete, elapsed time: 00:00:07
channel c2: starting archived log restore to user-specified destination
archived log destination=/oradata/arch/
channel c2: restoring archived log
archived log thread=2 sequence=27799
channel c2: reading from backup piece /databak/dadb/dadb_arc_1162890107_21508
channel c1: piece handle=/databak/dadb/dadb_arc_1162890092_21506 tag=DA_ARC_BAK
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:00:09
channel c2: piece handle=/databak/dadb/dadb_arc_1162890107_21508 tag=DA_ARC_BAK
channel c2: restored backup piece 1
channel c2: restore complete, elapsed time: 00:00:01
Finished restore at 06-MAR-24

released channel: c1

released channel: c2

13.执行恢复操作

RMAN> recover database;

Starting recover at 06-MAR-24
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1700 device type=DISK

starting media recovery

archived log for thread 1 with sequence 36191 is already on disk as file /oradata/arch/1_36191_939387772.arch
archived log for thread 1 with sequence 36192 is already on disk as file /oradata/arch/1_36192_939387772.arch
archived log for thread 2 with sequence 27798 is already on disk as file /oradata/arch/2_27798_939387772.arch
archived log for thread 2 with sequence 27799 is already on disk as file /oradata/arch/2_27799_939387772.arch
archived log file name=/oradata/arch/1_36191_939387772.arch thread=1 sequence=36191
archived log file name=/oradata/arch/2_27798_939387772.arch thread=2 sequence=27798
archived log file name=/oradata/arch/2_27799_939387772.arch thread=2 sequence=27799
archived log file name=/oradata/arch/1_36192_939387772.arch thread=1 sequence=36192
unable to find archived log
archived log thread=1 sequence=36193
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 03/06/2024 12:21:52
RMAN-06054: media recovery requesting unknown archived log for thread 1 with sequence 36193 and starting SCN of 18518339722150

上面提示需要日志序号为36193的归档日志文件,因为我的备份只备到日志序号为36192的归档日志。

RMAN> list backup;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
21345   Full    85.42M     DISK        00:00:00     06-MAR-24
        BP Key: 21346   Status: AVAILABLE  Compressed: NO  Tag: DA_CONTROL_BAK
        Piece Name: /databak/dadb/dadb_cntrl_21509_1_21509
  Control File Included: Ckp SCN: 18518339722264   Ckp time: 06-MAR-24

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
21346   Full    5.66G      DISK        00:00:00     06-MAR-24
        BP Key: 21347   Status: AVAILABLE  Compressed: YES  Tag: DA_FULL_BAK
        Piece Name: /databak/dadb/dadb_DADB_20240306_vu2l0hog_1_1
  List of Datafiles in backup set 21346
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 18518339718516 06-MAR-24 /oradata/dadb/sysaux01.dbf
  4       Full 18518339718516 06-MAR-24 /oradata/dadb/users.dbf
  6       Full 18518339718516 06-MAR-24 /oradata/dadb/hygeia.dbf
  7       Full 18518339718516 06-MAR-24 /oradata/dadb/system001.dbf
  10      Full 18518339718516 06-MAR-24 /oradata/dadb/test.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
21347   Full    5.20M      DISK        00:00:00     06-MAR-24
        BP Key: 21348   Status: AVAILABLE  Compressed: YES  Tag: DA_FULL_BAK
        Piece Name: /databak/dadb/dadb_DADB_20240306_002l0ijr_1_1
  Control File Included: Ckp SCN: 18518339720451   Ckp time: 06-MAR-24

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
21348   970.06M    DISK        00:00:00     06-MAR-24
        BP Key: 21349   Status: AVAILABLE  Compressed: NO  Tag: DA_ARC_BAK
        Piece Name: /databak/dadb/dadb_arc_1162890092_21506

  List of Archived Logs in backup set 21348
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    36171   18518338674292 02-MAR-24 18518338689793 02-MAR-24
  1    36172   18518338689793 02-MAR-24 18518338799839 03-MAR-24
  1    36173   18518338799839 03-MAR-24 18518338813263 03-MAR-24
  1    36174   18518338813263 03-MAR-24 18518338884449 03-MAR-24
  1    36175   18518338884449 03-MAR-24 18518338974024 03-MAR-24
  1    36176   18518338974024 03-MAR-24 18518338974039 03-MAR-24
  1    36177   18518338974039 03-MAR-24 18518338993139 03-MAR-24
  1    36178   18518338993139 03-MAR-24 18518339079673 04-MAR-24
  1    36179   18518339079673 04-MAR-24 18518339088612 04-MAR-24
  1    36180   18518339088612 04-MAR-24 18518339193641 04-MAR-24
  2    27786   18518338674296 02-MAR-24 18518338813706 03-MAR-24
  2    27787   18518338813706 03-MAR-24 18518338929221 03-MAR-24
  2    27788   18518338929221 03-MAR-24 18518338974028 03-MAR-24
  2    27789   18518338974028 03-MAR-24 18518338974042 03-MAR-24
  2    27790   18518338974042 03-MAR-24 18518339090540 04-MAR-24
  2    27791   18518339090540 04-MAR-24 18518339290871 04-MAR-24

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
21349   Full    80.00K     DISK        00:00:00     06-MAR-24
        BP Key: 21350   Status: AVAILABLE  Compressed: YES  Tag: DA_FULL_BAK
        Piece Name: /databak/dadb/dadb_DADB_20240306_012l0ijv_1_1
  SPFILE Included: Modification time: 05-MAR-24
  SPFILE db_unique_name: DADBP

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
21350   854.23M    DISK        00:00:00     06-MAR-24
        BP Key: 21351   Status: AVAILABLE  Compressed: NO  Tag: DA_ARC_BAK
        Piece Name: /databak/dadb/dadb_arc_1162890092_21507

  List of Archived Logs in backup set 21350
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    36181   18518339193641 04-MAR-24 18518339290866 04-MAR-24
  1    36182   18518339290866 04-MAR-24 18518339290887 04-MAR-24
  1    36183   18518339290887 04-MAR-24 18518339307311 04-MAR-24
  1    36184   18518339307311 04-MAR-24 18518339398770 05-MAR-24
  1    36185   18518339398770 05-MAR-24 18518339409567 05-MAR-24
  1    36186   18518339409567 05-MAR-24 18518339534019 05-MAR-24
  1    36187   18518339534019 05-MAR-24 18518339592978 05-MAR-24
  1    36188   18518339592978 05-MAR-24 18518339593000 05-MAR-24
  1    36189   18518339593000 05-MAR-24 18518339609217 05-MAR-24
  1    36190   18518339609217 05-MAR-24 18518339708119 06-MAR-24
  1    36191   18518339708119 06-MAR-24 18518339722138 06-MAR-24
  2    27792   18518339290871 04-MAR-24 18518339290882 04-MAR-24
  2    27793   18518339290882 04-MAR-24 18518339398968 05-MAR-24
  2    27794   18518339398968 05-MAR-24 18518339548475 05-MAR-24
  2    27795   18518339548475 05-MAR-24 18518339592982 05-MAR-24
  2    27796   18518339592982 05-MAR-24 18518339592995 05-MAR-24
  2    27797   18518339592995 05-MAR-24 18518339709370 06-MAR-24
  2    27798   18518339709370 06-MAR-24 18518339722134 06-MAR-24

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
21351   19.50K     DISK        00:00:00     06-MAR-24
        BP Key: 21352   Status: AVAILABLE  Compressed: NO  Tag: DA_ARC_BAK
        Piece Name: /databak/dadb/dadb_arc_1162890107_21508

  List of Archived Logs in backup set 21351
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    36192   18518339722138 06-MAR-24 18518339722150 06-MAR-24
  2    27799   18518339722134 06-MAR-24 18518339722196 06-MAR-24

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
21352   Full    4.52G      DISK        00:00:00     06-MAR-24
        BP Key: 21353   Status: AVAILABLE  Compressed: YES  Tag: DA_FULL_BAK
        Piece Name: /databak/dadb/dadb_DADB_20240306_vv2l0hog_1_1
  List of Datafiles in backup set 21352
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 18518339718518 06-MAR-24 /oradata/dadb/system.dbf
  3       Full 18518339718518 06-MAR-24 /oradata/dadb/undotbs1.dbf
  5       Full 18518339718518 06-MAR-24 /oradata/dadb/undotbs2.dbf
  8       Full 18518339718518 06-MAR-24 /oradata/dadb/sysaux.dbf
  9       Full 18518339718518 06-MAR-24 /oradata/dadb/cs01.dbf

执行按时间点或scn号的恢复操作。因为日志序号为36193的归档日志文件的scn号是从18518339722150开始,所以我们可以执行恢复到scn号=18518339722150为止。

RMAN> recover database until scn 18518339722150;

Starting recover at 06-MAR-24
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:01

Finished recover at 06-MAR-24

14.打开数据库。

RMAN> alter database open resetlogs;

database opened

[oracle@sjjh oradata]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Mar 6 12:25:01 2024

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> select instance_name,status from v$instance;

INSTANCE_NAME    STATUS
---------------- ------------
dadb             OPEN

恢复MySQL5.7中被Truncate掉的表

恢复MySQL被Truncate掉的表
innodb_file_per_table=ON 场景下,truncate 表后,.ibd 文件会收缩,需要扫描磁盘获取相应的数据页进行恢复。
下面以innodb_file_per_table=ON 场景下恢复为例
一.安装undrop-for-innodb软件
1:上传undrop-for-innodb-develop.zip

2:安装编译环境
yum install make gcc flex bison
3:解压

[root@localhost /]# unzip undrop-for-innodb-master.zip
Archive:  undrop-for-innodb-master.zip
ade0fbb31218f655eeff97f559d47c6545478734
   creating: undrop-for-innodb-master/
  inflating: undrop-for-innodb-master/LICENSE  
  inflating: undrop-for-innodb-master/Makefile  
  inflating: undrop-for-innodb-master/README.md  
  inflating: undrop-for-innodb-master/c_parser.c  
  inflating: undrop-for-innodb-master/check_data.c  
   creating: undrop-for-innodb-master/dictionary/
  inflating: undrop-for-innodb-master/dictionary/SYS_COLUMNS.sql  
  inflating: undrop-for-innodb-master/dictionary/SYS_FIELDS.sql  
  inflating: undrop-for-innodb-master/dictionary/SYS_INDEXES.sql  
  inflating: undrop-for-innodb-master/dictionary/SYS_TABLES.sql  
  inflating: undrop-for-innodb-master/fetch_data.sh  
   creating: undrop-for-innodb-master/include/
  inflating: undrop-for-innodb-master/include/bchange.c  
  inflating: undrop-for-innodb-master/include/bcmp.c  
  inflating: undrop-for-innodb-master/include/bfill.c  
  inflating: undrop-for-innodb-master/include/bmove.c  
  inflating: undrop-for-innodb-master/include/bmove512.c  
  inflating: undrop-for-innodb-master/include/bmove_upp.c  
  inflating: undrop-for-innodb-master/include/btr0btr.h  
  inflating: undrop-for-innodb-master/include/btr0btr.ic  
  inflating: undrop-for-innodb-master/include/btr0cur.h  
  inflating: undrop-for-innodb-master/include/btr0cur.ic  
  inflating: undrop-for-innodb-master/include/btr0types.h  
  inflating: undrop-for-innodb-master/include/buf0buf.h  
  inflating: undrop-for-innodb-master/include/buf0buf.ic  
  inflating: undrop-for-innodb-master/include/buf0flu.h  
  inflating: undrop-for-innodb-master/include/buf0flu.ic  
  inflating: undrop-for-innodb-master/include/buf0lru.h  
  inflating: undrop-for-innodb-master/include/buf0lru.ic  
  inflating: undrop-for-innodb-master/include/buf0rea.h  
  inflating: undrop-for-innodb-master/include/buf0types.h  
  inflating: undrop-for-innodb-master/include/check_data.h  
  inflating: undrop-for-innodb-master/include/ctype-bin.c  
  inflating: undrop-for-innodb-master/include/ctype-latin1.c  
  inflating: undrop-for-innodb-master/include/ctype-mb.c  
  inflating: undrop-for-innodb-master/include/ctype-simple.c  
  inflating: undrop-for-innodb-master/include/ctype-utf8.c  
  inflating: undrop-for-innodb-master/include/ctype.c  
  inflating: undrop-for-innodb-master/include/data0data.h  
  inflating: undrop-for-innodb-master/include/data0data.ic  
  inflating: undrop-for-innodb-master/include/data0type.h  
  inflating: undrop-for-innodb-master/include/data0type.ic  
  inflating: undrop-for-innodb-master/include/data0types.h  
  inflating: undrop-for-innodb-master/include/db0err.h  
  inflating: undrop-for-innodb-master/include/decimal.c  
  inflating: undrop-for-innodb-master/include/decimal.h  
  inflating: undrop-for-innodb-master/include/dict0dict.h  
  inflating: undrop-for-innodb-master/include/dict0dict.ic  
  inflating: undrop-for-innodb-master/include/dict0load.h  
  inflating: undrop-for-innodb-master/include/dict0load.ic  
  inflating: undrop-for-innodb-master/include/dict0mem.h  
  inflating: undrop-for-innodb-master/include/dict0mem.ic  
  inflating: undrop-for-innodb-master/include/dict0types.h  
  inflating: undrop-for-innodb-master/include/dyn0dyn.h  
  inflating: undrop-for-innodb-master/include/dyn0dyn.ic  
  inflating: undrop-for-innodb-master/include/fil0fil.h  
  inflating: undrop-for-innodb-master/include/fsp0fsp.h  
  inflating: undrop-for-innodb-master/include/fsp0fsp.ic  
  inflating: undrop-for-innodb-master/include/fut0fut.h  
  inflating: undrop-for-innodb-master/include/fut0fut.ic  
  inflating: undrop-for-innodb-master/include/fut0lst.h  
  inflating: undrop-for-innodb-master/include/fut0lst.ic  
  inflating: undrop-for-innodb-master/include/ha0ha.h  
  inflating: undrop-for-innodb-master/include/ha0ha.ic  
  inflating: undrop-for-innodb-master/include/hash0hash.h  
  inflating: undrop-for-innodb-master/include/hash0hash.ic  
  inflating: undrop-for-innodb-master/include/ib_config.h  
  inflating: undrop-for-innodb-master/include/ibuf0types.h  
  inflating: undrop-for-innodb-master/include/innochecksum.h  
  inflating: undrop-for-innodb-master/include/int2str.c  
  inflating: undrop-for-innodb-master/include/is_prefix.c  
  inflating: undrop-for-innodb-master/include/llstr.c  
  inflating: undrop-for-innodb-master/include/lock0types.h  
  inflating: undrop-for-innodb-master/include/longlong2str.c  
  inflating: undrop-for-innodb-master/include/m_ctype.h  
  inflating: undrop-for-innodb-master/include/m_string.h  
  inflating: undrop-for-innodb-master/include/mach0data.h  
  inflating: undrop-for-innodb-master/include/mach0data.ic  
  inflating: undrop-for-innodb-master/include/mem0dbg.h  
  inflating: undrop-for-innodb-master/include/mem0dbg.ic  
  inflating: undrop-for-innodb-master/include/mem0mem.h  
  inflating: undrop-for-innodb-master/include/mem0mem.ic  
  inflating: undrop-for-innodb-master/include/mem0pool.h  
  inflating: undrop-for-innodb-master/include/mem0pool.ic  
  inflating: undrop-for-innodb-master/include/mtr0log.h  
  inflating: undrop-for-innodb-master/include/mtr0log.ic  
  inflating: undrop-for-innodb-master/include/mtr0mtr.h  
  inflating: undrop-for-innodb-master/include/mtr0mtr.ic  
  inflating: undrop-for-innodb-master/include/mtr0types.h  
  inflating: undrop-for-innodb-master/include/my_alloc.h  
  inflating: undrop-for-innodb-master/include/my_attribute.h  
  inflating: undrop-for-innodb-master/include/my_base.h  
  inflating: undrop-for-innodb-master/include/my_config.h  
  inflating: undrop-for-innodb-master/include/my_dbug.h  
  inflating: undrop-for-innodb-master/include/my_global.h  
  inflating: undrop-for-innodb-master/include/my_list.h  
  inflating: undrop-for-innodb-master/include/my_pthread.h  
  inflating: undrop-for-innodb-master/include/my_strtoll10.c  
  inflating: undrop-for-innodb-master/include/my_sys.h  
  inflating: undrop-for-innodb-master/include/my_vsnprintf.c  
  inflating: undrop-for-innodb-master/include/my_xml.h  
  inflating: undrop-for-innodb-master/include/myisampack.h  
  inflating: undrop-for-innodb-master/include/mysql_def.h  
  inflating: undrop-for-innodb-master/include/os0file.h  
  inflating: undrop-for-innodb-master/include/os0proc.h  
  inflating: undrop-for-innodb-master/include/os0proc.ic  
  inflating: undrop-for-innodb-master/include/os0sync.h  
  inflating: undrop-for-innodb-master/include/os0sync.ic  
  inflating: undrop-for-innodb-master/include/os0thread.h  
  inflating: undrop-for-innodb-master/include/os0thread.ic  
  inflating: undrop-for-innodb-master/include/page0cur.h  
  inflating: undrop-for-innodb-master/include/page0cur.ic  
  inflating: undrop-for-innodb-master/include/page0page.h  
  inflating: undrop-for-innodb-master/include/page0page.ic  
  inflating: undrop-for-innodb-master/include/page0types.h  
  inflating: undrop-for-innodb-master/include/print_data.h  
  inflating: undrop-for-innodb-master/include/que0types.h  
  inflating: undrop-for-innodb-master/include/r_strinstr.c  
  inflating: undrop-for-innodb-master/include/raid.h  
  inflating: undrop-for-innodb-master/include/read0types.h  
  inflating: undrop-for-innodb-master/include/rem0cmp.h  
  inflating: undrop-for-innodb-master/include/rem0cmp.ic  
  inflating: undrop-for-innodb-master/include/rem0rec.h  
  inflating: undrop-for-innodb-master/include/rem0rec.ic  
  inflating: undrop-for-innodb-master/include/rem0types.h  
  inflating: undrop-for-innodb-master/include/row0types.h  
  inflating: undrop-for-innodb-master/include/srv0srv.h  
  inflating: undrop-for-innodb-master/include/str2int.c  
  inflating: undrop-for-innodb-master/include/str_alloc.c  
  inflating: undrop-for-innodb-master/include/strappend.c  
  inflating: undrop-for-innodb-master/include/strcend.c  
  inflating: undrop-for-innodb-master/include/strcont.c  
  inflating: undrop-for-innodb-master/include/strend.c  
  inflating: undrop-for-innodb-master/include/strfill.c  
  inflating: undrop-for-innodb-master/include/strinstr.c  
  inflating: undrop-for-innodb-master/include/strmake.c  
  inflating: undrop-for-innodb-master/include/strmov.c  
  inflating: undrop-for-innodb-master/include/strnlen.c  
  inflating: undrop-for-innodb-master/include/strnmov.c  
  inflating: undrop-for-innodb-master/include/strstr.c  
  inflating: undrop-for-innodb-master/include/strtod.c  
  inflating: undrop-for-innodb-master/include/strtol.c  
  inflating: undrop-for-innodb-master/include/strtoll.c  
  inflating: undrop-for-innodb-master/include/strtoul.c  
  inflating: undrop-for-innodb-master/include/strtoull.c  
  inflating: undrop-for-innodb-master/include/strxmov.c  
  inflating: undrop-for-innodb-master/include/strxnmov.c  
  inflating: undrop-for-innodb-master/include/sync0arr.h  
  inflating: undrop-for-innodb-master/include/sync0arr.ic  
  inflating: undrop-for-innodb-master/include/sync0rw.h  
  inflating: undrop-for-innodb-master/include/sync0rw.ic  
  inflating: undrop-for-innodb-master/include/sync0sync.h  
  inflating: undrop-for-innodb-master/include/sync0sync.ic  
  inflating: undrop-for-innodb-master/include/sync0types.h  
  inflating: undrop-for-innodb-master/include/tables_dict.h  
  inflating: undrop-for-innodb-master/include/trx0sys.h  
  inflating: undrop-for-innodb-master/include/trx0sys.ic  
  inflating: undrop-for-innodb-master/include/trx0trx.h  
  inflating: undrop-for-innodb-master/include/trx0trx.ic  
  inflating: undrop-for-innodb-master/include/trx0types.h  
  inflating: undrop-for-innodb-master/include/trx0undo.h  
  inflating: undrop-for-innodb-master/include/trx0undo.ic  
  inflating: undrop-for-innodb-master/include/trx0xa.h  
  inflating: undrop-for-innodb-master/include/typelib.h  
  inflating: undrop-for-innodb-master/include/univ.i  
  inflating: undrop-for-innodb-master/include/usr0types.h  
  inflating: undrop-for-innodb-master/include/ut0byte.h  
  inflating: undrop-for-innodb-master/include/ut0byte.ic  
  inflating: undrop-for-innodb-master/include/ut0dbg.h  
  inflating: undrop-for-innodb-master/include/ut0lst.h  
  inflating: undrop-for-innodb-master/include/ut0mem.h  
  inflating: undrop-for-innodb-master/include/ut0mem.ic  
  inflating: undrop-for-innodb-master/include/ut0rnd.h  
  inflating: undrop-for-innodb-master/include/ut0rnd.ic  
  inflating: undrop-for-innodb-master/include/ut0ut.h  
  inflating: undrop-for-innodb-master/include/ut0ut.ic  
  inflating: undrop-for-innodb-master/include/xml.c  
  inflating: undrop-for-innodb-master/innochecksum.c  
  inflating: undrop-for-innodb-master/print_data.c  
  inflating: undrop-for-innodb-master/recover_dictionary.sh  
   creating: undrop-for-innodb-master/sakila/
  inflating: undrop-for-innodb-master/sakila/actor.sql  
  inflating: undrop-for-innodb-master/sakila/address.sql  
  inflating: undrop-for-innodb-master/sakila/category.sql  
  inflating: undrop-for-innodb-master/sakila/city.sql  
  inflating: undrop-for-innodb-master/sakila/country.sql  
  inflating: undrop-for-innodb-master/sakila/customer.sql  
  inflating: undrop-for-innodb-master/sakila/film.sql  
  inflating: undrop-for-innodb-master/sakila/film_actor.sql  
  inflating: undrop-for-innodb-master/sakila/film_category.sql  
  inflating: undrop-for-innodb-master/sakila/inventory.sql  
  inflating: undrop-for-innodb-master/sakila/language.sql  
  inflating: undrop-for-innodb-master/sakila/payment.sql  
  inflating: undrop-for-innodb-master/sakila/rental.sql  
  inflating: undrop-for-innodb-master/sakila/sakila-db.tar.gz  
  inflating: undrop-for-innodb-master/sakila/staff.sql  
  inflating: undrop-for-innodb-master/sakila/store.sql  
  inflating: undrop-for-innodb-master/sql_parser.l  
  inflating: undrop-for-innodb-master/sql_parser.y  
  inflating: undrop-for-innodb-master/stream_parser.c  
  inflating: undrop-for-innodb-master/sys_parser.c  
  inflating: undrop-for-innodb-master/tables_dict.c  
  inflating: undrop-for-innodb-master/test.sh  

4:编译

[root@localhost /]# cd undrop-for-innodb-master
[root@localhost undrop-for-innodb-master]# ll
total 208
-rw-r--r--. 1 root root  6271 Oct  2  2015 check_data.c
-rw-r--r--. 1 root root 28689 Oct  2  2015 c_parser.c
drwxr-xr-x. 2 root root    92 Oct  2  2015 dictionary
-rw-r--r--. 1 root root  1978 Oct  2  2015 fetch_data.sh
drwxr-xr-x. 2 root root  4096 Oct  2  2015 include
-rw-r--r--. 1 root root  8936 Oct  2  2015 innochecksum.c
-rw-r--r--. 1 root root 18047 Oct  2  2015 LICENSE
-rw-r--r--. 1 root root  1816 Oct  2  2015 Makefile
-rw-r--r--. 1 root root 16585 Oct  2  2015 print_data.c
-rw-r--r--. 1 root root  3467 Oct  2  2015 README.md
-rwxr-xr-x. 1 root root  1536 Oct  2  2015 recover_dictionary.sh
drwxr-xr-x. 2 root root  4096 Oct  2  2015 sakila
-rw-r--r--. 1 root root  7244 Oct  2  2015 sql_parser.l
-rw-r--r--. 1 root root 25607 Oct  2  2015 sql_parser.y
-rw-r--r--. 1 root root 23004 Oct  2  2015 stream_parser.c
-rw-r--r--. 1 root root 14764 Oct  2  2015 sys_parser.c
-rw-r--r--. 1 root root  2237 Oct  2  2015 tables_dict.c
-rwxr-xr-x. 1 root root  6178 Oct  2  2015 test.sh
[root@localhost undrop-for-innodb-master]# make
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe  -I./include -c stream_parser.c
stream_parser.c: In function ‘valid_innodb_page’:
stream_parser.c:151:31: warning: variable ‘oldcsumfield’ set but not used [-Wunused-but-set-variable]
     unsigned int page_n_heap, oldcsumfield;
                               ^
stream_parser.c: In function ‘process_ibpage’:
stream_parser.c:313:9: warning: variable ‘sem’ set but not used [-Wunused-but-set-variable]
     int sem = (page_type == FIL_PAGE_INDEX) 
         ^
stream_parser.c: In function ‘process_ibfile’:
stream_parser.c:333:13: warning: variable ‘prev_disk_offset’ set but not used [-Wunused-but-set-variable]
     off64_t prev_disk_offset = 0;
             ^
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe  -I./include  -pthread -lm  stream_parser.o -o stream_parser
flex  sql_parser.l
bison  -o sql_parser.c sql_parser.y
sql_parser.y: warning: 6 shift/reduce conflicts [-Wconflicts-sr]
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe  -I./include -c sql_parser.c 
sql_parser.y: In function ‘yyparse’:
sql_parser.y:166:39: warning: variable ‘none’ set but not used [-Wunused-but-set-variable]
         field_def_t trx_id, roll_ptr, none;
                                       ^
In file included from sql_parser.y:660:0:
sql_parser.y: At top level:
lex.yy.c:3085:17: warning: ‘yyunput’ defined but not used [-Wunused-function]
     static void yyunput (int c, register char * yy_bp )
                 ^
lex.yy.c:3126:16: warning: ‘input’ defined but not used [-Wunused-function]
     static int input  (void)
                ^
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe  -I./include -c c_parser.c
In file included from c_parser.c:39:0:
decimal.c: In function ‘decimal_intg’:
decimal.c:1923:9: warning: variable ‘tmp_res’ set but not used [-Wunused-but-set-variable]
In file included from c_parser.c:35:0:
c_parser.c: At top level:
./include/ctype-latin1.c:359:5: warning: ‘my_mb_wc_latin1’ defined but not used [-Wunused-function]
 int my_mb_wc_latin1(CHARSET_INFO *cs  __attribute__((unused)),
     ^
./include/ctype-latin1.c:372:5: warning: ‘my_wc_mb_latin1’ defined but not used [-Wunused-function]
 int my_wc_mb_latin1(CHARSET_INFO *cs  __attribute__((unused)),
     ^
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe  -I./include -c tables_dict.c
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe  -I./include -c print_data.c
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe  -I./include -c check_data.c
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe   -I./include  sql_parser.o c_parser.o tables_dict.o print_data.o check_data.o -o c_parser -pthread -lm
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe   -I./include -o innochecksum_changer innochecksum.c
[root@localhost undrop-for-innodb-master]# ll
total 2904
-rw-r--r--. 1 root root    6271 Oct  2  2015 check_data.c
-rw-r--r--. 1 root root   66088 Jan 17 16:59 check_data.o
-rwxr-xr-x. 1 root root  725572 Jan 17 16:59 c_parser
-rw-r--r--. 1 root root   28689 Oct  2  2015 c_parser.c
-rw-r--r--. 1 root root 1038536 Jan 17 16:59 c_parser.o
drwxr-xr-x. 2 root root      92 Oct  2  2015 dictionary
-rw-r--r--. 1 root root    1978 Oct  2  2015 fetch_data.sh
drwxr-xr-x. 2 root root    4096 Oct  2  2015 include
-rw-r--r--. 1 root root    8936 Oct  2  2015 innochecksum.c
-rwxr-xr-x. 1 root root   36399 Jan 17 16:59 innochecksum_changer
-rw-r--r--. 1 root root  134778 Jan 17 16:59 lex.yy.c
-rw-r--r--. 1 root root   18047 Oct  2  2015 LICENSE
-rw-r--r--. 1 root root    1816 Oct  2  2015 Makefile
-rw-r--r--. 1 root root   16585 Oct  2  2015 print_data.c
-rw-r--r--. 1 root root  127136 Jan 17 16:59 print_data.o
-rw-r--r--. 1 root root    3467 Oct  2  2015 README.md
-rwxr-xr-x. 1 root root    1536 Oct  2  2015 recover_dictionary.sh
drwxr-xr-x. 2 root root    4096 Oct  2  2015 sakila
-rw-r--r--. 1 root root  102053 Jan 17 16:59 sql_parser.c
-rw-r--r--. 1 root root    7244 Oct  2  2015 sql_parser.l
-rw-r--r--. 1 root root  287296 Jan 17 16:59 sql_parser.o
-rw-r--r--. 1 root root   25607 Oct  2  2015 sql_parser.y
-rwxr-xr-x. 1 root root   63657 Jan 17 16:59 stream_parser
-rw-r--r--. 1 root root   23004 Oct  2  2015 stream_parser.c
-rw-r--r--. 1 root root  114944 Jan 17 16:59 stream_parser.o
-rw-r--r--. 1 root root   14764 Oct  2  2015 sys_parser.c
-rw-r--r--. 1 root root    2237 Oct  2  2015 tables_dict.c
-rw-r--r--. 1 root root   40176 Jan 17 16:59 tables_dict.o
-rwxr-xr-x. 1 root root    6178 Oct  2  2015 test.sh
[root@localhost undrop-for-innodb-master]#  make sys_parser
/mysqlsoft/mysql/bin/mysql_config
cc -o sys_parser sys_parser.c `mysql_config --cflags` `mysql_config --libs`

5:验证
编译完成后在undrop-for-innodb 目录下生成stream_parser 和c_parser, sys_parser 文件。

[root@localhost undrop-for-innodb-master]# ll
total 2928
-rw-r--r--. 1 root root    6271 Oct  2  2015 check_data.c
-rw-r--r--. 1 root root   66088 Jan 17 16:59 check_data.o
-rwxr-xr-x. 1 root root  725572 Jan 17 16:59 c_parser
-rw-r--r--. 1 root root   28689 Oct  2  2015 c_parser.c
-rw-r--r--. 1 root root 1038536 Jan 17 16:59 c_parser.o
drwxr-xr-x. 2 root root      92 Oct  2  2015 dictionary
-rw-r--r--. 1 root root    1978 Oct  2  2015 fetch_data.sh
drwxr-xr-x. 2 root root    4096 Oct  2  2015 include
-rw-r--r--. 1 root root    8936 Oct  2  2015 innochecksum.c
-rwxr-xr-x. 1 root root   36399 Jan 17 16:59 innochecksum_changer
-rw-r--r--. 1 root root  134778 Jan 17 16:59 lex.yy.c
-rw-r--r--. 1 root root   18047 Oct  2  2015 LICENSE
-rw-r--r--. 1 root root    1816 Oct  2  2015 Makefile
-rw-r--r--. 1 root root   16585 Oct  2  2015 print_data.c
-rw-r--r--. 1 root root  127136 Jan 17 16:59 print_data.o
-rw-r--r--. 1 root root    3467 Oct  2  2015 README.md
-rwxr-xr-x. 1 root root    1536 Oct  2  2015 recover_dictionary.sh
drwxr-xr-x. 2 root root    4096 Oct  2  2015 sakila
-rw-r--r--. 1 root root  102053 Jan 17 16:59 sql_parser.c
-rw-r--r--. 1 root root    7244 Oct  2  2015 sql_parser.l
-rw-r--r--. 1 root root  287296 Jan 17 16:59 sql_parser.o
-rw-r--r--. 1 root root   25607 Oct  2  2015 sql_parser.y
-rwxr-xr-x. 1 root root   63657 Jan 17 16:59 stream_parser
-rw-r--r--. 1 root root   23004 Oct  2  2015 stream_parser.c
-rw-r--r--. 1 root root  114944 Jan 17 16:59 stream_parser.o
-rwxr-xr-x. 1 root root   20650 Jan 17 17:05 sys_parser
-rw-r--r--. 1 root root   14764 Oct  2  2015 sys_parser.c
-rw-r--r--. 1 root root    2237 Oct  2  2015 tables_dict.c
-rw-r--r--. 1 root root   40176 Jan 17 16:59 tables_dict.o
-rwxr-xr-x. 1 root root    6178 Oct  2  2015 test.sh

二.执行truncate table恢复操作
1:执行truncate table命令删除表中所有记录

mysql> select * from t2;
+------+
| i    |
+------+
|    3 |
|    7 |
|   11 |
|   15 |
|    2 |
|    6 |
|   10 |
|   14 |
+------+
8 rows in set (0.00 sec)

mysql> truncate table t2;
Query OK, 0 rows affected (0.27 sec)

mysql> select * from t2;
Empty set (0.00 sec)

2:确认硬盘分区

[root@localhost undrop-for-innodb-master]# more /mysqlsoft/mysql/my.cnf | grep datadir
datadir=/mysqldata/mysql

[root@localhost undrop-for-innodb-master]# df -h /mysqldata/mysql
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/ol-root   72G   64G  8.0G  89% /

3:扫描硬盘分区
由于truncate 操作会把磁盘上对应的ibd 文件也一起删除,因此需要扫描磁盘,找到对应的数据页

[root@localhost undrop-for-innodb-master]# ./stream_parser -f /dev/mapper/ol-root -t 72G
Opening file: /dev/mapper/ol-root
File information:

Opening file: /dev/mapper/ol-root
File information:

Opening file: /dev/mapper/ol-root
File information:

ID of device containing file:            5
ID of device containing file:            5
ID of device containing file:            5
inode number:                        10610
inode number:                        10610
inode number:                        10610
protection:                          60660 protection:                          60660 protection:                          60660 (block device)
(block device)
(block device)
number of hard links:                    1
number of hard links:                    1
number of hard links:                    1
user ID of owner:                        0
user ID of owner:                        0
user ID of owner:                        0
group ID of owner:                       6
group ID of owner:                       6
group ID of owner:                       6
device ID (if special file):         64768
device ID (if special file):         64768
device ID (if special file):         64768
blocksize for filesystem I/O:         4096
blocksize for filesystem I/O:         4096
blocksize for filesystem I/O:         4096
number of blocks allocated:              0
number of blocks allocated:              0
number of blocks allocated:              0
time of last access:            1705593249 Thu Jan 18 23:54:09 2024
time of last access:            1705593249 Thu Jan 18 23:54:09 2024
time of last access:            1705593249 Thu Jan 18 23:54:09 2024
time of last modification:      1661337281 Wed Aug 24 18:34:41 2022
time of last modification:      1661337281 Wed Aug 24 18:34:41 2022
time of last modification:      1661337281 Wed Aug 24 18:34:41 2022
time of last status change:     1661337281 Wed Aug 24 18:34:41 2022
time of last status change:     1661337281 Wed Aug 24 18:34:41 2022
time of last status change:     1661337281 Wed Aug 24 18:34:41 2022
total size, in bytes:                    0 (0.000 exp(+0))

total size, in bytes:                    0 (0.000 exp(+0))

total size, in bytes:                    0 (0.000 exp(+0))

Size to process:               77309411328 (72.000 GiB)
Size to process:               77309411328 (72.000 GiB)
Size to process:               77309411328 (72.000 GiB)
Opening file: /dev/mapper/ol-root
File information:

ID of device containing file:            5
inode number:                        10610
protection:                          60660 (block device)
number of hard links:                    1
user ID of owner:                        0
group ID of owner:                       6
device ID (if special file):         64768
blocksize for filesystem I/O:         4096
number of blocks allocated:              0
time of last access:            1705593249 Thu Jan 18 23:54:09 2024
time of last modification:      1661337281 Wed Aug 24 18:34:41 2022
time of last status change:     1661337281 Wed Aug 24 18:34:41 2022
total size, in bytes:                    0 (0.000 exp(+0))

Size to process:               77309411328 (72.000 GiB)
Worker(1): 1.08% done. 2024-01-22 22:26:54 ETA(in 00:07:55). Processing speed: 38.325 MiB/sec
Worker(0): 1.08% done. 2024-01-22 22:26:55 ETA(in 00:07:55). Processing speed: 38.325 MiB/sec
Worker(2): 1.08% done. 2024-01-22 22:26:55 ETA(in 00:07:55). Processing speed: 38.328 MiB/sec
Worker(3): 1.08% done. 2024-01-22 22:26:55 ETA(in 00:07:55). Processing speed: 38.325 MiB/sec
Worker(1): 2.12% done. 2024-01-22 22:26:54 ETA(in 00:07:50). Processing speed: 38.325 MiB/sec
Worker(2): 2.12% done. 2024-01-22 22:26:55 ETA(in 00:07:50). Processing speed: 38.325 MiB/sec
Worker(3): 2.12% done. 2024-01-22 22:26:55 ETA(in 00:07:50). Processing speed: 38.325 MiB/sec
Worker(0): 2.12% done. 2024-01-22 22:26:55 ETA(in 00:07:50). Processing speed: 38.325 MiB/sec
Worker(1): 3.16% done. 2024-01-22 22:25:20 ETA(in 00:06:12). Processing speed: 47.907 MiB/sec
Worker(2): 3.16% done. 2024-01-22 22:25:21 ETA(in 00:06:12). Processing speed: 47.907 MiB/sec
Worker(3): 3.16% done. 2024-01-22 22:26:55 ETA(in 00:07:45). Processing speed: 38.325 MiB/sec
Worker(0): 3.16% done. 2024-01-22 22:26:55 ETA(in 00:07:45). Processing speed: 38.326 MiB/sec
Worker(1): 4.20% done. 2024-01-22 22:26:53 ETA(in 00:07:40). Processing speed: 38.328 MiB/sec
Worker(2): 4.20% done. 2024-01-22 22:25:21 ETA(in 00:06:08). Processing speed: 47.906 MiB/sec
Worker(3): 4.20% done. 2024-01-22 22:25:22 ETA(in 00:06:08). Processing speed: 47.906 MiB/sec
Worker(0): 4.20% done. 2024-01-22 22:26:55 ETA(in 00:07:40). Processing speed: 38.325 MiB/sec
Worker(1): 5.24% done. 2024-01-22 22:25:21 ETA(in 00:06:04). Processing speed: 47.907 MiB/sec
Worker(2): 5.24% done. 2024-01-22 22:26:53 ETA(in 00:07:35). Processing speed: 38.326 MiB/sec
Worker(3): 5.24% done. 2024-01-22 22:26:54 ETA(in 00:07:35). Processing speed: 38.325 MiB/sec
Worker(0): 5.24% done. 2024-01-22 22:26:55 ETA(in 00:07:35). Processing speed: 38.325 MiB/sec
Worker(1): 6.28% done. 2024-01-22 22:26:52 ETA(in 00:07:30). Processing speed: 38.325 MiB/sec
Worker(2): 6.28% done. 2024-01-22 22:25:22 ETA(in 00:06:00). Processing speed: 47.907 MiB/sec
Worker(3): 6.28% done. 2024-01-22 22:25:23 ETA(in 00:06:00). Processing speed: 47.906 MiB/sec
Worker(0): 6.28% done. 2024-01-22 22:26:55 ETA(in 00:07:30). Processing speed: 38.325 MiB/sec
Worker(1): 7.32% done. 2024-01-22 22:25:22 ETA(in 00:05:56). Processing speed: 47.911 MiB/sec
Worker(2): 7.32% done. 2024-01-22 22:26:52 ETA(in 00:07:25). Processing speed: 38.325 MiB/sec
Worker(3): 7.32% done. 2024-01-22 22:28:23 ETA(in 00:08:54). Processing speed: 31.938 MiB/sec
Worker(2): 8.36% done. 2024-01-22 22:23:54 ETA(in 00:04:24). Processing speed: 63.921 MiB/sec
Worker(0): 7.32% done. 2024-01-22 22:28:25 ETA(in 00:08:54). Processing speed: 31.943 MiB/sec
Worker(1): 8.36% done. 2024-01-22 22:26:51 ETA(in 00:07:20). Processing speed: 38.327 MiB/sec
Worker(3): 8.36% done. 2024-01-22 22:25:25 ETA(in 00:05:52). Processing speed: 47.906 MiB/sec
Worker(2): 9.40% done. 2024-01-22 22:26:50 ETA(in 00:07:15). Processing speed: 38.338 MiB/sec
Worker(0): 8.36% done. 2024-01-22 22:28:25 ETA(in 00:08:48). Processing speed: 31.945 MiB/sec
Worker(1): 9.40% done. 2024-01-22 22:28:19 ETA(in 00:08:42). Processing speed: 31.940 MiB/sec
Worker(3): 9.40% done. 2024-01-22 22:28:21 ETA(in 00:08:42). Processing speed: 31.938 MiB/sec
Worker(2): 10.44% done. 2024-01-22 22:28:17 ETA(in 00:08:36). Processing speed: 31.940 MiB/sec
Worker(0): 9.40% done. 2024-01-22 22:25:29 ETA(in 00:05:48). Processing speed: 47.945 MiB/sec
Worker(1): 10.44% done. 2024-01-22 22:26:52 ETA(in 00:07:10). Processing speed: 38.325 MiB/sec
Worker(3): 10.44% done. 2024-01-22 22:25:27 ETA(in 00:05:44). Processing speed: 47.910 MiB/sec
Worker(0): 10.44% done. 2024-01-22 22:25:29 ETA(in 00:05:44). Processing speed: 47.962 MiB/sec
Worker(2): 11.48% done. 2024-01-22 22:25:25 ETA(in 00:05:40). Processing speed: 47.910 MiB/sec
Worker(1): 11.48% done. 2024-01-22 22:25:26 ETA(in 00:05:40). Processing speed: 47.914 MiB/sec
Worker(3): 11.48% done. 2024-01-22 22:26:53 ETA(in 00:07:05). Processing speed: 38.333 MiB/sec
Worker(2): 12.52% done. 2024-01-22 22:25:25 ETA(in 00:05:36). Processing speed: 47.978 MiB/sec
Worker(0): 11.48% done. 2024-01-22 22:25:29 ETA(in 00:05:40). Processing speed: 47.907 MiB/sec
Worker(1): 12.52% done. 2024-01-22 22:26:51 ETA(in 00:07:00). Processing speed: 38.325 MiB/sec
Worker(3): 12.52% done. 2024-01-22 22:26:53 ETA(in 00:07:00). Processing speed: 38.331 MiB/sec
Worker(2): 13.56% done. 2024-01-22 22:31:01 ETA(in 00:11:04). Processing speed: 23.965 MiB/sec
Worker(0): 12.52% done. 2024-01-22 22:32:35 ETA(in 00:12:37). Processing speed: 21.295 MiB/sec
Worker(1): 13.56% done. 2024-01-22 22:31:04 ETA(in 00:11:05). Processing speed: 23.953 MiB/sec
Worker(3): 13.56% done. 2024-01-22 22:29:42 ETA(in 00:09:42). Processing speed: 27.375 MiB/sec
Worker(2): 14.60% done. 2024-01-22 22:25:29 ETA(in 00:05:28). Processing speed: 47.938 MiB/sec
Worker(0): 13.56% done. 2024-01-22 22:26:58 ETA(in 00:06:55). Processing speed: 38.328 MiB/sec
Worker(1): 14.60% done. 2024-01-22 22:25:31 ETA(in 00:05:28). Processing speed: 47.906 MiB/sec
Worker(3): 14.60% done. 2024-01-22 22:26:55 ETA(in 00:06:50). Processing speed: 38.325 MiB/sec
Worker(2): 15.64% done. 2024-01-22 22:25:29 ETA(in 00:05:24). Processing speed: 47.906 MiB/sec
Worker(1): 15.64% done. 2024-01-22 22:25:31 ETA(in 00:05:24). Processing speed: 47.906 MiB/sec
Worker(0): 14.60% done. 2024-01-22 22:28:21 ETA(in 00:08:12). Processing speed: 31.938 MiB/sec
Worker(2): 16.68% done. 2024-01-22 22:26:50 ETA(in 00:06:40). Processing speed: 38.325 MiB/sec
Worker(3): 15.64% done. 2024-01-22 22:26:55 ETA(in 00:06:45). Processing speed: 38.328 MiB/sec
Worker(1): 16.68% done. 2024-01-22 22:25:31 ETA(in 00:05:20). Processing speed: 47.912 MiB/sec
Worker(2): 17.72% done. 2024-01-22 22:24:10 ETA(in 00:03:57). Processing speed: 63.880 MiB/sec
Worker(1): 17.72% done. 2024-01-22 22:24:11 ETA(in 00:03:57). Processing speed: 63.909 MiB/sec
Worker(0): 15.64% done. 2024-01-22 22:26:59 ETA(in 00:06:45). Processing speed: 38.331 MiB/sec
Worker(3): 16.68% done. 2024-01-22 22:26:55 ETA(in 00:06:40). Processing speed: 38.335 MiB/sec
Worker(2): 18.76% done. 2024-01-22 22:25:29 ETA(in 00:05:12). Processing speed: 47.906 MiB/sec
Worker(1): 18.76% done. 2024-01-22 22:26:49 ETA(in 00:06:30). Processing speed: 38.325 MiB/sec
Worker(3): 17.72% done. 2024-01-22 22:25:35 ETA(in 00:05:16). Processing speed: 47.910 MiB/sec
Worker(0): 16.68% done. 2024-01-22 22:28:20 ETA(in 00:08:00). Processing speed: 31.940 MiB/sec
Worker(2): 19.80% done. 2024-01-22 22:25:29 ETA(in 00:05:08). Processing speed: 47.906 MiB/sec
Worker(1): 19.80% done. 2024-01-22 22:25:31 ETA(in 00:05:08). Processing speed: 47.906 MiB/sec
Worker(3): 18.76% done. 2024-01-22 22:26:54 ETA(in 00:06:30). Processing speed: 38.325 MiB/sec
Worker(2): 20.84% done. 2024-01-22 22:25:29 ETA(in 00:05:04). Processing speed: 47.953 MiB/sec
Worker(0): 17.72% done. 2024-01-22 22:27:00 ETA(in 00:06:35). Processing speed: 38.325 MiB/sec
Worker(1): 20.84% done. 2024-01-22 22:25:31 ETA(in 00:05:04). Processing speed: 47.906 MiB/sec
Worker(3): 19.80% done. 2024-01-22 22:25:36 ETA(in 00:05:08). Processing speed: 47.906 MiB/sec
Worker(2): 21.88% done. 2024-01-22 22:25:29 ETA(in 00:05:00). Processing speed: 47.906 MiB/sec
Worker(0): 18.76% done. 2024-01-22 22:28:19 ETA(in 00:07:48). Processing speed: 31.938 MiB/sec
Worker(1): 21.88% done. 2024-01-22 22:26:47 ETA(in 00:06:15). Processing speed: 38.325 MiB/sec
Worker(3): 20.84% done. 2024-01-22 22:26:53 ETA(in 00:06:20). Processing speed: 38.325 MiB/sec
Worker(2): 22.92% done. 2024-01-22 22:25:29 ETA(in 00:04:56). Processing speed: 47.906 MiB/sec
Worker(0): 19.80% done. 2024-01-22 22:27:01 ETA(in 00:06:25). Processing speed: 38.331 MiB/sec
Worker(1): 22.92% done. 2024-01-22 22:25:32 ETA(in 00:04:56). Processing speed: 47.906 MiB/sec
Worker(2): 23.96% done. 2024-01-22 22:25:29 ETA(in 00:04:52). Processing speed: 47.939 MiB/sec
Worker(3): 21.88% done. 2024-01-22 22:25:37 ETA(in 00:05:00). Processing speed: 47.911 MiB/sec
Worker(2): 25.00% done. 2024-01-22 22:24:16 ETA(in 00:03:36). Processing speed: 63.948 MiB/sec
Worker(1): 23.96% done. 2024-01-22 22:25:32 ETA(in 00:04:52). Processing speed: 47.914 MiB/sec
Worker(3): 22.92% done. 2024-01-22 22:25:37 ETA(in 00:04:56). Processing speed: 47.906 MiB/sec
Worker(0): 20.84% done. 2024-01-22 22:28:18 ETA(in 00:07:36). Processing speed: 31.938 MiB/sec
Worker(1): 25.00% done. 2024-01-22 22:24:19 ETA(in 00:03:36). Processing speed: 63.927 MiB/sec
Worker(2): 26.04% done. 2024-01-22 22:24:16 ETA(in 00:03:33). Processing speed: 63.875 MiB/sec
Worker(3): 23.96% done. 2024-01-22 22:26:51 ETA(in 00:06:05). Processing speed: 38.325 MiB/sec
Worker(1): 26.04% done. 2024-01-22 22:25:31 ETA(in 00:04:44). Processing speed: 47.906 MiB/sec
Worker(0): 21.88% done. 2024-01-22 22:27:02 ETA(in 00:06:15). Processing speed: 38.325 MiB/sec
Worker(2): 27.08% done. 2024-01-22 22:26:38 ETA(in 00:05:50). Processing speed: 38.331 MiB/sec
Worker(3): 25.00% done. 2024-01-22 22:25:38 ETA(in 00:04:48). Processing speed: 47.910 MiB/sec
Worker(1): 27.08% done. 2024-01-22 22:25:31 ETA(in 00:04:40). Processing speed: 47.906 MiB/sec
Worker(2): 28.12% done. 2024-01-22 22:25:28 ETA(in 00:04:36). Processing speed: 47.915 MiB/sec
Worker(0): 22.92% done. 2024-01-22 22:27:02 ETA(in 00:06:10). Processing speed: 38.328 MiB/sec
Worker(3): 26.04% done. 2024-01-22 22:26:50 ETA(in 00:05:55). Processing speed: 38.325 MiB/sec
Worker(1): 28.12% done. 2024-01-22 22:25:31 ETA(in 00:04:36). Processing speed: 47.906 MiB/sec
Worker(2): 29.16% done. 2024-01-22 22:25:28 ETA(in 00:04:32). Processing speed: 47.906 MiB/sec
Worker(0): 23.96% done. 2024-01-22 22:27:02 ETA(in 00:06:05). Processing speed: 38.325 MiB/sec
Worker(3): 27.07% done. 2024-01-22 22:25:39 ETA(in 00:04:40). Processing speed: 47.907 MiB/sec
Worker(1): 29.16% done. 2024-01-22 22:26:40 ETA(in 00:05:40). Processing speed: 38.325 MiB/sec
Worker(2): 30.20% done. 2024-01-22 22:25:28 ETA(in 00:04:28). Processing speed: 47.907 MiB/sec
Worker(0): 25.00% done. 2024-01-22 22:25:49 ETA(in 00:04:48). Processing speed: 47.912 MiB/sec
Worker(3): 28.11% done. 2024-01-22 22:26:49 ETA(in 00:05:45). Processing speed: 38.325 MiB/sec
Worker(1): 30.20% done. 2024-01-22 22:26:40 ETA(in 00:05:35). Processing speed: 38.326 MiB/sec
Worker(2): 31.24% done. 2024-01-22 22:26:35 ETA(in 00:05:30). Processing speed: 38.325 MiB/sec
Worker(0): 26.04% done. 2024-01-22 22:27:01 ETA(in 00:05:55). Processing speed: 38.334 MiB/sec
Worker(3): 29.16% done. 2024-01-22 22:24:31 ETA(in 00:03:24). Processing speed: 63.953 MiB/sec
Worker(0): 27.08% done. 2024-01-22 22:24:39 ETA(in 00:03:30). Processing speed: 63.940 MiB/sec
Worker(2): 32.28% done. 2024-01-22 22:26:35 ETA(in 00:05:25). Processing speed: 38.325 MiB/sec
Worker(1): 31.23% done. 2024-01-22 22:26:40 ETA(in 00:05:30). Processing speed: 38.325 MiB/sec
Worker(3): 30.20% done. 2024-01-22 22:25:39 ETA(in 00:04:28). Processing speed: 47.922 MiB/sec
Worker(2): 33.32% done. 2024-01-22 22:24:25 ETA(in 00:03:12). Processing speed: 63.881 MiB/sec
Worker(0): 28.12% done. 2024-01-22 22:26:59 ETA(in 00:05:45). Processing speed: 38.325 MiB/sec
Worker(1): 32.27% done. 2024-01-22 22:26:40 ETA(in 00:05:25). Processing speed: 38.325 MiB/sec
Worker(3): 31.24% done. 2024-01-22 22:26:46 ETA(in 00:05:30). Processing speed: 38.325 MiB/sec
Worker(2): 34.36% done. 2024-01-22 22:25:29 ETA(in 00:04:12). Processing speed: 47.949 MiB/sec
Worker(0): 29.16% done. 2024-01-22 22:26:59 ETA(in 00:05:40). Processing speed: 38.331 MiB/sec
Worker(1): 33.31% done. 2024-01-22 22:25:35 ETA(in 00:04:16). Processing speed: 47.906 MiB/sec
Worker(3): 32.27% done. 2024-01-22 22:24:34 ETA(in 00:03:15). Processing speed: 63.875 MiB/sec
Worker(2): 35.40% done. 2024-01-22 22:24:26 ETA(in 00:03:06). Processing speed: 63.896 MiB/sec
Worker(0): 30.20% done. 2024-01-22 22:25:51 ETA(in 00:04:28). Processing speed: 47.906 MiB/sec
Worker(1): 34.35% done. 2024-01-22 22:26:39 ETA(in 00:05:15). Processing speed: 38.325 MiB/sec
Worker(3): 33.31% done. 2024-01-22 22:26:44 ETA(in 00:05:20). Processing speed: 38.325 MiB/sec
Worker(2): 36.44% done. 2024-01-22 22:26:30 ETA(in 00:05:05). Processing speed: 38.325 MiB/sec
Worker(1): 35.39% done. 2024-01-22 22:25:36 ETA(in 00:04:08). Processing speed: 47.910 MiB/sec
Worker(0): 31.24% done. 2024-01-22 22:26:58 ETA(in 00:05:30). Processing speed: 38.325 MiB/sec
Worker(3): 34.35% done. 2024-01-22 22:25:40 ETA(in 00:04:12). Processing speed: 47.906 MiB/sec
Worker(2): 37.48% done. 2024-01-22 22:25:29 ETA(in 00:04:00). Processing speed: 47.906 MiB/sec
Worker(3): 35.40% done. 2024-01-22 22:24:37 ETA(in 00:03:06). Processing speed: 64.000 MiB/sec
Worker(1): 36.43% done. 2024-01-22 22:24:34 ETA(in 00:03:03). Processing speed: 63.875 MiB/sec
Worker(0): 32.28% done. 2024-01-22 22:24:46 ETA(in 00:03:15). Processing speed: 63.875 MiB/sec
Worker(3): 36.44% done. 2024-01-22 22:22:33 ETA(in 00:01:01). Processing speed: 192.000 MiB/sec
Worker(2): 38.52% done. 2024-01-22 22:24:29 ETA(in 00:02:57). Processing speed: 63.875 MiB/sec
Worker(3): 37.48% done. 2024-01-22 22:22:33 ETA(in 00:01:00). Processing speed: 192.000 MiB/sec
Worker(1): 37.47% done. 2024-01-22 22:23:33 ETA(in 00:02:00). Processing speed: 95.891 MiB/sec
Worker(3): 38.52% done. 2024-01-22 22:22:33 ETA(in 00:00:59). Processing speed: 192.000 MiB/sec
Worker(0): 33.32% done. 2024-01-22 22:24:46 ETA(in 00:03:12). Processing speed: 63.875 MiB/sec
Worker(3): 39.56% done. 2024-01-22 22:22:33 ETA(in 00:00:58). Processing speed: 192.000 MiB/sec
Worker(1): 38.51% done. 2024-01-22 22:23:33 ETA(in 00:01:58). Processing speed: 95.969 MiB/sec
Worker(2): 39.56% done. 2024-01-22 22:25:28 ETA(in 00:03:52). Processing speed: 47.906 MiB/sec
Worker(3): 40.60% done. 2024-01-22 22:22:33 ETA(in 00:00:57). Processing speed: 192.000 MiB/sec
Worker(0): 34.36% done. 2024-01-22 22:24:46 ETA(in 00:03:09). Processing speed: 63.875 MiB/sec
Worker(1): 39.56% done. 2024-01-22 22:23:33 ETA(in 00:01:56). Processing speed: 95.898 MiB/sec
Worker(3): 41.65% done. 2024-01-22 22:22:33 ETA(in 00:00:56). Processing speed: 192.000 MiB/sec
Worker(1): 40.60% done. 2024-01-22 22:22:35 ETA(in 00:00:57). Processing speed: 192.000 MiB/sec
Worker(3): 42.69% done. 2024-01-22 22:22:33 ETA(in 00:00:55). Processing speed: 192.000 MiB/sec
Worker(2): 40.60% done. 2024-01-22 22:23:32 ETA(in 00:01:54). Processing speed: 95.813 MiB/sec
Worker(1): 41.73% done. 2024-01-22 22:22:30 ETA(in 00:00:51). Processing speed: 208.000 MiB/sec
Worker(3): 43.73% done. 2024-01-22 22:22:33 ETA(in 00:00:54). Processing speed: 192.000 MiB/sec
Worker(0): 35.40% done. 2024-01-22 22:24:46 ETA(in 00:03:06). Processing speed: 63.885 MiB/sec
Worker(1): 42.77% done. 2024-01-22 22:23:30 ETA(in 00:01:49). Processing speed: 96.000 MiB/sec
Worker(2): 41.64% done. 2024-01-22 22:24:29 ETA(in 00:02:48). Processing speed: 63.875 MiB/sec
Worker(3): 44.77% done. 2024-01-22 22:23:27 ETA(in 00:01:46). Processing speed: 96.000 MiB/sec
Worker(0): 36.44% done. 2024-01-22 22:23:44 ETA(in 00:02:02). Processing speed: 95.898 MiB/sec
Worker(1): 43.81% done. 2024-01-22 22:22:35 ETA(in 00:00:53). Processing speed: 192.000 MiB/sec
Worker(3): 45.81% done. 2024-01-22 22:22:34 ETA(in 00:00:52). Processing speed: 192.000 MiB/sec
Worker(1): 44.89% done. 2024-01-22 22:22:33 ETA(in 00:00:50). Processing speed: 200.000 MiB/sec
Worker(3): 46.85% done. 2024-01-22 22:22:34 ETA(in 00:00:51). Processing speed: 192.000 MiB/sec
Worker(0): 37.48% done. 2024-01-22 22:22:43 ETA(in 00:01:00). Processing speed: 191.977 MiB/sec
Worker(2): 42.68% done. 2024-01-22 22:23:33 ETA(in 00:01:50). Processing speed: 95.813 MiB/sec
Worker(1): 46.93% done. 2024-01-22 22:22:10 ETA(in 00:00:26). Processing speed: 376.000 MiB/sec
Worker(3): 48.33% done. 2024-01-22 22:22:19 ETA(in 00:00:35). Processing speed: 272.000 MiB/sec
Worker(0): 38.52% done. 2024-01-22 22:25:43 ETA(in 00:03:56). Processing speed: 47.996 MiB/sec
Worker(1): 47.98% done. 2024-01-22 22:25:07 ETA(in 00:03:19). Processing speed: 48.000 MiB/sec
Worker(3): 49.37% done. 2024-01-22 22:25:02 ETA(in 00:03:14). Processing speed: 48.000 MiB/sec
Worker(0): 39.56% done. 2024-01-22 22:25:43 ETA(in 00:03:52). Processing speed: 47.996 MiB/sec
Worker(1): 49.02% done. 2024-01-22 22:25:07 ETA(in 00:03:15). Processing speed: 48.000 MiB/sec
Worker(2): 43.72% done. 2024-01-22 22:31:49 ETA(in 00:09:55). Processing speed: 17.420 MiB/sec
Worker(3): 50.41% done. 2024-01-22 22:28:16 ETA(in 00:06:20). Processing speed: 24.000 MiB/sec
Worker(1): 50.06% done. 2024-01-22 22:25:07 ETA(in 00:03:11). Processing speed: 48.000 MiB/sec
Worker(0): 40.60% done. 2024-01-22 22:26:41 ETA(in 00:04:45). Processing speed: 38.400 MiB/sec
Worker(3): 51.45% done. 2024-01-22 22:22:43 ETA(in 00:00:46). Processing speed: 192.000 MiB/sec
Worker(0): 41.64% done. 2024-01-22 22:22:53 ETA(in 00:00:56). Processing speed: 192.000 MiB/sec
Worker(1): 51.10% done. 2024-01-22 22:22:43 ETA(in 00:00:46). Processing speed: 192.000 MiB/sec
Worker(2): 44.76% done. 2024-01-22 22:24:36 ETA(in 00:02:39). Processing speed: 63.875 MiB/sec
Worker(3): 52.50% done. 2024-01-22 22:22:43 ETA(in 00:00:45). Processing speed: 192.000 MiB/sec
Worker(0): 42.69% done. 2024-01-22 22:22:53 ETA(in 00:00:55). Processing speed: 192.000 MiB/sec
Worker(1): 52.14% done. 2024-01-22 22:22:43 ETA(in 00:00:45). Processing speed: 192.000 MiB/sec
Worker(0): 44.12% done. 2024-01-22 22:22:38 ETA(in 00:00:39). Processing speed: 264.000 MiB/sec
Worker(3): 54.41% done. 2024-01-22 22:22:22 ETA(in 00:00:23). Processing speed: 352.000 MiB/sec
Worker(1): 53.18% done. 2024-01-22 22:22:43 ETA(in 00:00:44). Processing speed: 192.000 MiB/sec
Worker(2): 45.80% done. 2024-01-22 22:23:43 ETA(in 00:01:44). Processing speed: 95.813 MiB/sec
Worker(3): 56.23% done. 2024-01-22 22:22:24 ETA(in 00:00:24). Processing speed: 336.000 MiB/sec
Worker(0): 46.16% done. 2024-01-22 22:22:26 ETA(in 00:00:26). Processing speed: 376.000 MiB/sec
Worker(1): 54.79% done. 2024-01-22 22:22:28 ETA(in 00:00:28). Processing speed: 296.000 MiB/sec
Worker(3): 58.01% done. 2024-01-22 22:22:24 ETA(in 00:00:23). Processing speed: 328.000 MiB/sec
Worker(0): 48.02% done. 2024-01-22 22:22:28 ETA(in 00:00:27). Processing speed: 344.000 MiB/sec
Worker(1): 56.57% done. 2024-01-22 22:22:25 ETA(in 00:00:24). Processing speed: 328.000 MiB/sec
Worker(2): 46.84% done. 2024-01-22 22:23:43 ETA(in 00:01:42). Processing speed: 95.813 MiB/sec
Worker(1): 58.35% done. 2024-01-22 22:22:25 ETA(in 00:00:23). Processing speed: 328.000 MiB/sec
Worker(3): 59.87% done. 2024-01-22 22:22:23 ETA(in 00:00:21). Processing speed: 344.000 MiB/sec
Worker(0): 49.72% done. 2024-01-22 22:22:31 ETA(in 00:00:29). Processing speed: 312.000 MiB/sec
Worker(2): 47.88% done. 2024-01-22 22:22:52 ETA(in 00:00:50). Processing speed: 191.625 MiB/sec
Worker(0): 51.15% done. 2024-01-22 22:22:37 ETA(in 00:00:34). Processing speed: 264.000 MiB/sec
Worker(1): 60.39% done. 2024-01-22 22:22:22 ETA(in 00:00:19). Processing speed: 376.000 MiB/sec
Worker(3): 61.74% done. 2024-01-22 22:22:23 ETA(in 00:00:20). Processing speed: 344.000 MiB/sec
Worker(0): 53.02% done. 2024-01-22 22:22:29 ETA(in 00:00:25). Processing speed: 344.000 MiB/sec
Worker(1): 62.47% done. 2024-01-22 22:22:22 ETA(in 00:00:18). Processing speed: 384.000 MiB/sec
Worker(3): 63.22% done. 2024-01-22 22:22:28 ETA(in 00:00:24). Processing speed: 272.000 MiB/sec
Worker(2): 48.92% done. 2024-01-22 22:23:42 ETA(in 00:01:38). Processing speed: 95.813 MiB/sec
Worker(1): 63.90% done. 2024-01-22 22:22:30 ETA(in 00:00:25). Processing speed: 264.000 MiB/sec
Worker(0): 55.01% done. 2024-01-22 22:22:27 ETA(in 00:00:22). Processing speed: 368.000 MiB/sec
Worker(3): 65.08% done. 2024-01-22 22:22:23 ETA(in 00:00:18). Processing speed: 344.000 MiB/sec
Worker(2): 49.96% done. 2024-01-22 22:22:53 ETA(in 00:00:48). Processing speed: 191.937 MiB/sec
Worker(3): 66.73% done. 2024-01-22 22:22:26 ETA(in 00:00:20). Processing speed: 304.000 MiB/sec
Worker(0): 56.71% done. 2024-01-22 22:22:31 ETA(in 00:00:25). Processing speed: 312.000 MiB/sec
Worker(2): 51.17% done. 2024-01-22 22:22:46 ETA(in 00:00:40). Processing speed: 224.000 MiB/sec
Worker(1): 65.08% done. 2024-01-22 22:22:35 ETA(in 00:00:29). Processing speed: 216.000 MiB/sec
Worker(3): 68.47% done. 2024-01-22 22:22:25 ETA(in 00:00:18). Processing speed: 320.000 MiB/sec
Worker(2): 52.73% done. 2024-01-22 22:22:37 ETA(in 00:00:30). Processing speed: 288.000 MiB/sec
Worker(1): 66.77% done. 2024-01-22 22:22:26 ETA(in 00:00:19). Processing speed: 312.000 MiB/sec
Worker(0): 58.05% done. 2024-01-22 22:22:38 ETA(in 00:00:31). Processing speed: 248.000 MiB/sec
Worker(2): 54.60% done. 2024-01-22 22:22:32 ETA(in 00:00:24). Processing speed: 344.000 MiB/sec
Worker(1): 68.46% done. 2024-01-22 22:22:26 ETA(in 00:00:18). Processing speed: 312.000 MiB/sec
Worker(0): 59.35% done. 2024-01-22 22:22:39 ETA(in 00:00:31). Processing speed: 240.000 MiB/sec
Worker(3): 69.90% done. 2024-01-22 22:22:29 ETA(in 00:00:21). Processing speed: 264.000 MiB/sec
Worker(1): 70.28% done. 2024-01-22 22:22:25 ETA(in 00:00:16). Processing speed: 336.000 MiB/sec
Worker(3): 71.46% done. 2024-01-22 22:22:27 ETA(in 00:00:18). Processing speed: 288.000 MiB/sec
Worker(0): 60.92% done. 2024-01-22 22:22:34 ETA(in 00:00:25). Processing speed: 288.000 MiB/sec
Worker(2): 55.95% done. 2024-01-22 22:22:41 ETA(in 00:00:32). Processing speed: 248.000 MiB/sec
Worker(3): 72.94% done. 2024-01-22 22:22:28 ETA(in 00:00:18). Processing speed: 272.000 MiB/sec
Worker(0): 62.30% done. 2024-01-22 22:22:37 ETA(in 00:00:27). Processing speed: 256.000 MiB/sec
Worker(2): 57.64% done. 2024-01-22 22:22:35 ETA(in 00:00:25). Processing speed: 312.000 MiB/sec
Worker(1): 71.98% done. 2024-01-22 22:22:26 ETA(in 00:00:16). Processing speed: 312.000 MiB/sec
Worker(2): 59.59% done. 2024-01-22 22:22:31 ETA(in 00:00:20). Processing speed: 360.000 MiB/sec
Worker(1): 73.15% done. 2024-01-22 22:22:33 ETA(in 00:00:22). Processing speed: 216.000 MiB/sec
Worker(0): 63.69% done. 2024-01-22 22:22:37 ETA(in 00:00:26). Processing speed: 256.000 MiB/sec
Worker(3): 74.76% done. 2024-01-22 22:22:24 ETA(in 00:00:13). Processing speed: 336.000 MiB/sec
Worker(0): 65.21% done. 2024-01-22 22:22:34 ETA(in 00:00:22). Processing speed: 280.000 MiB/sec
Worker(1): 74.80% done. 2024-01-22 22:22:27 ETA(in 00:00:15). Processing speed: 304.000 MiB/sec
Worker(3): 76.19% done. 2024-01-22 22:22:28 ETA(in 00:00:16). Processing speed: 264.000 MiB/sec
Worker(2): 61.28% done. 2024-01-22 22:22:34 ETA(in 00:00:22). Processing speed: 312.000 MiB/sec
Worker(1): 76.62% done. 2024-01-22 22:22:25 ETA(in 00:00:12). Processing speed: 336.000 MiB/sec
Worker(0): 66.69% done. 2024-01-22 22:22:35 ETA(in 00:00:22). Processing speed: 272.000 MiB/sec
Worker(3): 77.71% done. 2024-01-22 22:22:27 ETA(in 00:00:14). Processing speed: 280.000 MiB/sec
Worker(2): 62.80% done. 2024-01-22 22:22:37 ETA(in 00:00:24). Processing speed: 280.000 MiB/sec
Worker(0): 68.21% done. 2024-01-22 22:22:34 ETA(in 00:00:20). Processing speed: 280.000 MiB/sec
Worker(3): 79.10% done. 2024-01-22 22:22:29 ETA(in 00:00:15). Processing speed: 256.000 MiB/sec
Worker(1): 78.40% done. 2024-01-22 22:22:26 ETA(in 00:00:12). Processing speed: 328.000 MiB/sec
Worker(2): 64.45% done. 2024-01-22 22:22:35 ETA(in 00:00:21). Processing speed: 304.000 MiB/sec
Worker(1): 79.92% done. 2024-01-22 22:22:28 ETA(in 00:00:13). Processing speed: 280.000 MiB/sec
Worker(0): 70.16% done. 2024-01-22 22:22:30 ETA(in 00:00:15). Processing speed: 360.000 MiB/sec
Worker(2): 65.84% done. 2024-01-22 22:22:39 ETA(in 00:00:24). Processing speed: 256.000 MiB/sec
Worker(3): 80.53% done. 2024-01-22 22:22:28 ETA(in 00:00:13). Processing speed: 264.000 MiB/sec
Worker(2): 67.10% done. 2024-01-22 22:22:42 ETA(in 00:00:26). Processing speed: 232.000 MiB/sec
Worker(1): 81.48% done. 2024-01-22 22:22:27 ETA(in 00:00:11). Processing speed: 288.000 MiB/sec
Worker(3): 82.23% done. 2024-01-22 22:22:26 ETA(in 00:00:10). Processing speed: 312.000 MiB/sec
Worker(0): 71.98% done. 2024-01-22 22:22:31 ETA(in 00:00:15). Processing speed: 336.000 MiB/sec
Worker(3): 84.01% done. 2024-01-22 22:22:25 ETA(in 00:00:08). Processing speed: 328.000 MiB/sec
Worker(0): 73.68% done. 2024-01-22 22:22:32 ETA(in 00:00:15). Processing speed: 312.000 MiB/sec
Worker(2): 68.62% done. 2024-01-22 22:22:37 ETA(in 00:00:20). Processing speed: 280.000 MiB/sec
Worker(1): 82.83% done. 2024-01-22 22:22:29 ETA(in 00:00:12). Processing speed: 248.000 MiB/sec
Worker(3): 85.53% done. 2024-01-22 22:22:27 ETA(in 00:00:09). Processing speed: 280.000 MiB/sec
Worker(2): 70.53% done. 2024-01-22 22:22:33 ETA(in 00:00:15). Processing speed: 352.000 MiB/sec
Worker(1): 84.13% done. 2024-01-22 22:22:30 ETA(in 00:00:12). Processing speed: 240.000 MiB/sec
Worker(0): 75.24% done. 2024-01-22 22:22:33 ETA(in 00:00:15). Processing speed: 288.000 MiB/sec
Worker(1): 85.43% done. 2024-01-22 22:22:30 ETA(in 00:00:11). Processing speed: 240.000 MiB/sec
Worker(0): 76.76% done. 2024-01-22 22:22:34 ETA(in 00:00:15). Processing speed: 280.000 MiB/sec
Worker(2): 72.31% done. 2024-01-22 22:22:34 ETA(in 00:00:15). Processing speed: 328.000 MiB/sec
Worker(3): 87.18% done. 2024-01-22 22:22:26 ETA(in 00:00:07). Processing speed: 304.000 MiB/sec
Worker(2): 73.83% done. 2024-01-22 22:22:37 ETA(in 00:00:17). Processing speed: 280.000 MiB/sec
Worker(3): 88.43% done. 2024-01-22 22:22:29 ETA(in 00:00:09). Processing speed: 232.000 MiB/sec
Worker(1): 87.25% done. 2024-01-22 22:22:26 ETA(in 00:00:06). Processing speed: 336.000 MiB/sec
Worker(0): 78.49% done. 2024-01-22 22:22:32 ETA(in 00:00:12). Processing speed: 320.000 MiB/sec
Worker(0): 80.10% done. 2024-01-22 22:22:33 ETA(in 00:00:12). Processing speed: 296.000 MiB/sec
Worker(1): 88.77% done. 2024-01-22 22:22:28 ETA(in 00:00:07). Processing speed: 280.000 MiB/sec
Worker(2): 75.09% done. 2024-01-22 22:22:40 ETA(in 00:00:19). Processing speed: 232.000 MiB/sec
Worker(3): 90.34% done. 2024-01-22 22:22:26 ETA(in 00:00:05). Processing speed: 352.000 MiB/sec
Worker(1): 90.60% done. 2024-01-22 22:22:27 ETA(in 00:00:05). Processing speed: 336.000 MiB/sec
Worker(3): 91.95% done. 2024-01-22 22:22:27 ETA(in 00:00:05). Processing speed: 296.000 MiB/sec
Worker(2): 76.52% done. 2024-01-22 22:22:38 ETA(in 00:00:16). Processing speed: 264.000 MiB/sec
Worker(0): 81.53% done. 2024-01-22 22:22:34 ETA(in 00:00:12). Processing speed: 264.000 MiB/sec
Worker(2): 78.17% done. 2024-01-22 22:22:36 ETA(in 00:00:13). Processing speed: 304.000 MiB/sec
Worker(3): 93.69% done. 2024-01-22 22:22:26 ETA(in 00:00:03). Processing speed: 320.000 MiB/sec
Worker(1): 92.29% done. 2024-01-22 22:22:27 ETA(in 00:00:04). Processing speed: 312.000 MiB/sec
Worker(0): 82.70% done. 2024-01-22 22:22:37 ETA(in 00:00:14). Processing speed: 216.000 MiB/sec
Worker(0): 84.27% done. 2024-01-22 22:22:34 ETA(in 00:00:10). Processing speed: 288.000 MiB/sec
Worker(1): 94.11% done. 2024-01-22 22:22:27 ETA(in 00:00:03). Processing speed: 336.000 MiB/sec
Worker(2): 79.56% done. 2024-01-22 22:22:38 ETA(in 00:00:14). Processing speed: 256.000 MiB/sec
Worker(3): 95.20% done. 2024-01-22 22:22:27 ETA(in 00:00:03). Processing speed: 280.000 MiB/sec
Worker(3): 96.68% done. 2024-01-22 22:22:27 ETA(in 00:00:02). Processing speed: 272.000 MiB/sec
Worker(2): 81.08% done. 2024-01-22 22:22:37 ETA(in 00:00:12). Processing speed: 280.000 MiB/sec
Worker(1): 95.68% done. 2024-01-22 22:22:27 ETA(in 00:00:02). Processing speed: 288.000 MiB/sec
Worker(0): 86.00% done. 2024-01-22 22:22:33 ETA(in 00:00:08). Processing speed: 320.000 MiB/sec
Worker(1): 97.32% done. 2024-01-22 22:22:27 ETA(in 00:00:01). Processing speed: 304.000 MiB/sec
Worker(2): 82.77% done. 2024-01-22 22:22:36 ETA(in 00:00:10). Processing speed: 312.000 MiB/sec
Worker(0): 88.00% done. 2024-01-22 22:22:32 ETA(in 00:00:06). Processing speed: 368.000 MiB/sec
Worker(0): 90.13% done. 2024-01-22 22:22:31 ETA(in 00:00:04). Processing speed: 392.000 MiB/sec
Worker(2): 84.90% done. 2024-01-22 22:22:34 ETA(in 00:00:07). Processing speed: 392.000 MiB/sec
Worker(1): 98.89% done. 2024-01-22 22:22:27 ETA(in 00:00:00). Processing speed: 287.969 MiB/sec
Worker(2): 87.24% done. 2024-01-22 22:22:33 ETA(in 00:00:05). Processing speed: 432.000 MiB/sec
Worker(0): 92.51% done. 2024-01-22 22:22:31 ETA(in 00:00:03). Processing speed: 440.000 MiB/sec
Worker(1): 99.93% done. 2024-01-22 22:22:28 ETA(in 00:00:00). Processing speed: 191.627 MiB/sec
Worker(2): 89.63% done. 2024-01-22 22:22:33 ETA(in 00:00:04). Processing speed: 440.000 MiB/sec
Worker(0): 94.90% done. 2024-01-22 22:22:31 ETA(in 00:00:02). Processing speed: 440.000 MiB/sec
Worker(0): 97.20% done. 2024-01-22 22:22:31 ETA(in 00:00:01). Processing speed: 424.000 MiB/sec
Worker(2): 91.97% done. 2024-01-22 22:22:33 ETA(in 00:00:03). Processing speed: 432.000 MiB/sec
Worker(0): 99.41% done. 2024-01-22 22:22:31 ETA(in 00:00:00). Processing speed: 408.000 MiB/sec
Worker(2): 94.36% done. 2024-01-22 22:22:33 ETA(in 00:00:02). Processing speed: 440.000 MiB/sec
Worker(2): 97.00% done. 2024-01-22 22:22:33 ETA(in 00:00:01). Processing speed: 488.000 MiB/sec
Worker(2): 98.65% done. 2024-01-22 22:22:33 ETA(in 00:00:00). Processing speed: 303.845 MiB/sec
Worker(2): 99.69% done. 2024-01-22 22:22:35 ETA(in 00:00:00). Processing speed: 95.820 MiB/sec
All workers finished in 221 sec

4:查找表数据对应的page 页
确认对应的索引页主键索引是61

mysql> select * from information_schema.INNODB_SYS_TABLES d where d.name='test/t2';
Empty set (0.14 sec)

mysql> select * from information_schema.INNODB_SYS_TABLES d where d.name like 'test/t2%';
+----------+--------------+------+--------+-------+-------------+------------+---------------+------------+
| TABLE_ID | NAME         | FLAG | N_COLS | SPACE | FILE_FORMAT | ROW_FORMAT | ZIP_PAGE_SIZE | SPACE_TYPE |
+----------+--------------+------+--------+-------+-------------+------------+---------------+------------+
|       53 | test/t2#P#p0 |   33 |      4 |    26 | Barracuda   | Dynamic    |             0 | Single     |
|       54 | test/t2#P#p1 |   33 |      4 |    27 | Barracuda   | Dynamic    |             0 | Single     |
|       55 | test/t2#P#p2 |   33 |      4 |    28 | Barracuda   | Dynamic    |             0 | Single     |
|       56 | test/t2#P#p3 |   33 |      4 |    29 | Barracuda   | Dynamic    |             0 | Single     |
+----------+--------------+------+--------+-------+-------------+------------+---------------+------------+
4 rows in set (0.00 sec)

mysql> show create table t2\G
*************************** 1. row ***************************
       Table: t2
Create Table: CREATE TABLE `t2` (
  `i` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
/*!50100 PARTITION BY KEY (i)
PARTITIONS 4 */
1 row in set (0.00 sec)

表test/t2是一个分区表,所以相当于4个表查找index_id语句要根据table_id来执行四次。

mysql> select * from information_schema.innodb_sys_indexes where table_id=53;
+----------+-----------------+----------+------+----------+---------+-------+-----------------+
| INDEX_ID | NAME            | TABLE_ID | TYPE | N_FIELDS | PAGE_NO | SPACE | MERGE_THRESHOLD |
+----------+-----------------+----------+------+----------+---------+-------+-----------------+
|       44 | GEN_CLUST_INDEX |       53 |    1 |        0 |       3 |    26 |              50 |
+----------+-----------------+----------+------+----------+---------+-------+-----------------+
1 row in set (0.00 sec)

mysql> select * from information_schema.innodb_sys_indexes where table_id=54;
+----------+-----------------+----------+------+----------+---------+-------+-----------------+
| INDEX_ID | NAME            | TABLE_ID | TYPE | N_FIELDS | PAGE_NO | SPACE | MERGE_THRESHOLD |
+----------+-----------------+----------+------+----------+---------+-------+-----------------+
|       45 | GEN_CLUST_INDEX |       54 |    1 |        0 |       3 |    27 |              50 |
+----------+-----------------+----------+------+----------+---------+-------+-----------------+
1 row in set (0.00 sec)

mysql> select * from information_schema.innodb_sys_indexes where table_id=55;
+----------+-----------------+----------+------+----------+---------+-------+-----------------+
| INDEX_ID | NAME            | TABLE_ID | TYPE | N_FIELDS | PAGE_NO | SPACE | MERGE_THRESHOLD |
+----------+-----------------+----------+------+----------+---------+-------+-----------------+
|       46 | GEN_CLUST_INDEX |       55 |    1 |        0 |       3 |    28 |              50 |
+----------+-----------------+----------+------+----------+---------+-------+-----------------+
1 row in set (0.00 sec)

mysql> select * from information_schema.innodb_sys_indexes where table_id=56;
+----------+-----------------+----------+------+----------+---------+-------+-----------------+
| INDEX_ID | NAME            | TABLE_ID | TYPE | N_FIELDS | PAGE_NO | SPACE | MERGE_THRESHOLD |
+----------+-----------------+----------+------+----------+---------+-------+-----------------+
|       47 | GEN_CLUST_INDEX |       56 |    1 |        0 |       3 |    29 |              50 |
+----------+-----------------+----------+------+----------+---------+-------+-----------------+
1 row in set (0.00 sec)

5:解析磁盘页中删除表的记录

[root@localhost lib]# vi /tmp/t2.sql
CREATE TABLE `t2` (
  `i` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
/*!50100 PARTITION BY KEY (i)
PARTITIONS 4 */;

因为表test/t2有四个分区所以需要解析四次

[root@localhost undrop-for-innodb-master]# ./c_parser -6f /undrop-for-innodb-master/pages-ol-root/FIL_PAGE_INDEX/0000000000000044.page -t /tmp/t2.sql > dumps/default/t2_1 2> dumps/default/t2_1_load.sql
[root@localhost undrop-for-innodb-master]# ./c_parser -6f /undrop-for-innodb-master/pages-ol-root/FIL_PAGE_INDEX/0000000000000045.page -t /tmp/t2.sql > dumps/default/t2_2 2> dumps/default/t2_2_load.sql
[root@localhost undrop-for-innodb-master]# ./c_parser -6f /undrop-for-innodb-master/pages-ol-root/FIL_PAGE_INDEX/0000000000000046.page -t /tmp/t2.sql > dumps/default/t2_3 2> dumps/default/t2_3_load.sql
[root@localhost undrop-for-innodb-master]# ./c_parser -6f /undrop-for-innodb-master/pages-ol-root/FIL_PAGE_INDEX/0000000000000047.page -t /tmp/t2.sql > dumps/default/t2_4 2> dumps/default/t2_4_load.sql

6:导入数据
因为表test/t2是分区表,生成使用load命令加载数据时生成的数据文件是t2与表名相同,并不会我所指定的文件名。所以要做修改

[root@localhost default]# cat t2_1_load.sql
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/undrop-for-innodb-master/dumps/default/t2' REPLACE INTO TABLE `t2` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 't2\t' (`i`);
[root@localhost default]# cat t2_2_load.sql
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/undrop-for-innodb-master/dumps/default/t2' REPLACE INTO TABLE `t2` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 't2\t' (`i`);

[root@localhost default]# cat t2_3_load.sql
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/undrop-for-innodb-master/dumps/default/t2' REPLACE INTO TABLE `t2` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 't2\t' (`i`);

[root@localhost default]# cat t2_4_load.sql
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/undrop-for-innodb-master/dumps/default/t2' REPLACE INTO TABLE `t2` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 't2\t' (`i`);

[root@localhost default]# vi t2_1_load.sql
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/undrop-for-innodb-master/dumps/default/t2_1' REPLACE INTO TABLE `t2` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 't2\t' (`i`);

[root@localhost default]# vi t2_2_load.sql
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/undrop-for-innodb-master/dumps/default/t2_2' REPLACE INTO TABLE `t2` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 't2\t' (`i`);

[root@localhost default]# vi t2_3_load.sql
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/undrop-for-innodb-master/dumps/default/t2_3' REPLACE INTO TABLE `t2` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 't2\t' (`i`);

[root@localhost default]# vi t2_4_load.sql
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/undrop-for-innodb-master/dumps/default/t2_4' REPLACE INTO TABLE `t2` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 't2\t' (`i`);


mysql> source /undrop-for-innodb-master/dumps/default/t2_1_load.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)
Records: 0  Deleted: 0  Skipped: 0  Warnings: 0

mysql> source /undrop-for-innodb-master/dumps/default/t2_2_load.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)
Records: 0  Deleted: 0  Skipped: 0  Warnings: 0

mysql> source /undrop-for-innodb-master/dumps/default/t2_3_load.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 4 rows affected (0.06 sec)
Records: 4  Deleted: 0  Skipped: 0  Warnings: 0

mysql> source /undrop-for-innodb-master/dumps/default/t2_4_load.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 4 rows affected (0.03 sec)
Records: 4  Deleted: 0  Skipped: 0  Warnings: 0

mysql> select * from t2;
+------+
| i    |
+------+
|    3 |
|    7 |
|   11 |
|   15 |
|    2 |
|    6 |
|   10 |
|   14 |
+------+
8 rows in set (0.00 sec)

到此数据已经恢复了。

恢复MySQL5.7中被Drop掉的表

恢复MySQL 5.7被Drop掉的表
innodb_file_per_table=ON 场景下,drop 表后,.ibd 文件也被删除了,需要扫描磁盘获取相应的数据页进行恢复。而如果是innodb_file_per_table=OFF,则数据存放在共享表空间ibdata1里的,只要扫描该ibdata1 文件即可。下面以innodb_file_per_table=ON 场景下恢复为例
一.安装undrop-for-innodb软件
1:上传undrop-for-innodb-develop.zip

2:安装编译环境
yum install make gcc flex bison
3:解压

[root@localhost /]# unzip undrop-for-innodb-master.zip
Archive:  undrop-for-innodb-master.zip
ade0fbb31218f655eeff97f559d47c6545478734
   creating: undrop-for-innodb-master/
  inflating: undrop-for-innodb-master/LICENSE  
  inflating: undrop-for-innodb-master/Makefile  
  inflating: undrop-for-innodb-master/README.md  
  inflating: undrop-for-innodb-master/c_parser.c  
  inflating: undrop-for-innodb-master/check_data.c  
   creating: undrop-for-innodb-master/dictionary/
  inflating: undrop-for-innodb-master/dictionary/SYS_COLUMNS.sql  
  inflating: undrop-for-innodb-master/dictionary/SYS_FIELDS.sql  
  inflating: undrop-for-innodb-master/dictionary/SYS_INDEXES.sql  
  inflating: undrop-for-innodb-master/dictionary/SYS_TABLES.sql  
  inflating: undrop-for-innodb-master/fetch_data.sh  
   creating: undrop-for-innodb-master/include/
  inflating: undrop-for-innodb-master/include/bchange.c  
  inflating: undrop-for-innodb-master/include/bcmp.c  
  inflating: undrop-for-innodb-master/include/bfill.c  
  inflating: undrop-for-innodb-master/include/bmove.c  
  inflating: undrop-for-innodb-master/include/bmove512.c  
  inflating: undrop-for-innodb-master/include/bmove_upp.c  
  inflating: undrop-for-innodb-master/include/btr0btr.h  
  inflating: undrop-for-innodb-master/include/btr0btr.ic  
  inflating: undrop-for-innodb-master/include/btr0cur.h  
  inflating: undrop-for-innodb-master/include/btr0cur.ic  
  inflating: undrop-for-innodb-master/include/btr0types.h  
  inflating: undrop-for-innodb-master/include/buf0buf.h  
  inflating: undrop-for-innodb-master/include/buf0buf.ic  
  inflating: undrop-for-innodb-master/include/buf0flu.h  
  inflating: undrop-for-innodb-master/include/buf0flu.ic  
  inflating: undrop-for-innodb-master/include/buf0lru.h  
  inflating: undrop-for-innodb-master/include/buf0lru.ic  
  inflating: undrop-for-innodb-master/include/buf0rea.h  
  inflating: undrop-for-innodb-master/include/buf0types.h  
  inflating: undrop-for-innodb-master/include/check_data.h  
  inflating: undrop-for-innodb-master/include/ctype-bin.c  
  inflating: undrop-for-innodb-master/include/ctype-latin1.c  
  inflating: undrop-for-innodb-master/include/ctype-mb.c  
  inflating: undrop-for-innodb-master/include/ctype-simple.c  
  inflating: undrop-for-innodb-master/include/ctype-utf8.c  
  inflating: undrop-for-innodb-master/include/ctype.c  
  inflating: undrop-for-innodb-master/include/data0data.h  
  inflating: undrop-for-innodb-master/include/data0data.ic  
  inflating: undrop-for-innodb-master/include/data0type.h  
  inflating: undrop-for-innodb-master/include/data0type.ic  
  inflating: undrop-for-innodb-master/include/data0types.h  
  inflating: undrop-for-innodb-master/include/db0err.h  
  inflating: undrop-for-innodb-master/include/decimal.c  
  inflating: undrop-for-innodb-master/include/decimal.h  
  inflating: undrop-for-innodb-master/include/dict0dict.h  
  inflating: undrop-for-innodb-master/include/dict0dict.ic  
  inflating: undrop-for-innodb-master/include/dict0load.h  
  inflating: undrop-for-innodb-master/include/dict0load.ic  
  inflating: undrop-for-innodb-master/include/dict0mem.h  
  inflating: undrop-for-innodb-master/include/dict0mem.ic  
  inflating: undrop-for-innodb-master/include/dict0types.h  
  inflating: undrop-for-innodb-master/include/dyn0dyn.h  
  inflating: undrop-for-innodb-master/include/dyn0dyn.ic  
  inflating: undrop-for-innodb-master/include/fil0fil.h  
  inflating: undrop-for-innodb-master/include/fsp0fsp.h  
  inflating: undrop-for-innodb-master/include/fsp0fsp.ic  
  inflating: undrop-for-innodb-master/include/fut0fut.h  
  inflating: undrop-for-innodb-master/include/fut0fut.ic  
  inflating: undrop-for-innodb-master/include/fut0lst.h  
  inflating: undrop-for-innodb-master/include/fut0lst.ic  
  inflating: undrop-for-innodb-master/include/ha0ha.h  
  inflating: undrop-for-innodb-master/include/ha0ha.ic  
  inflating: undrop-for-innodb-master/include/hash0hash.h  
  inflating: undrop-for-innodb-master/include/hash0hash.ic  
  inflating: undrop-for-innodb-master/include/ib_config.h  
  inflating: undrop-for-innodb-master/include/ibuf0types.h  
  inflating: undrop-for-innodb-master/include/innochecksum.h  
  inflating: undrop-for-innodb-master/include/int2str.c  
  inflating: undrop-for-innodb-master/include/is_prefix.c  
  inflating: undrop-for-innodb-master/include/llstr.c  
  inflating: undrop-for-innodb-master/include/lock0types.h  
  inflating: undrop-for-innodb-master/include/longlong2str.c  
  inflating: undrop-for-innodb-master/include/m_ctype.h  
  inflating: undrop-for-innodb-master/include/m_string.h  
  inflating: undrop-for-innodb-master/include/mach0data.h  
  inflating: undrop-for-innodb-master/include/mach0data.ic  
  inflating: undrop-for-innodb-master/include/mem0dbg.h  
  inflating: undrop-for-innodb-master/include/mem0dbg.ic  
  inflating: undrop-for-innodb-master/include/mem0mem.h  
  inflating: undrop-for-innodb-master/include/mem0mem.ic  
  inflating: undrop-for-innodb-master/include/mem0pool.h  
  inflating: undrop-for-innodb-master/include/mem0pool.ic  
  inflating: undrop-for-innodb-master/include/mtr0log.h  
  inflating: undrop-for-innodb-master/include/mtr0log.ic  
  inflating: undrop-for-innodb-master/include/mtr0mtr.h  
  inflating: undrop-for-innodb-master/include/mtr0mtr.ic  
  inflating: undrop-for-innodb-master/include/mtr0types.h  
  inflating: undrop-for-innodb-master/include/my_alloc.h  
  inflating: undrop-for-innodb-master/include/my_attribute.h  
  inflating: undrop-for-innodb-master/include/my_base.h  
  inflating: undrop-for-innodb-master/include/my_config.h  
  inflating: undrop-for-innodb-master/include/my_dbug.h  
  inflating: undrop-for-innodb-master/include/my_global.h  
  inflating: undrop-for-innodb-master/include/my_list.h  
  inflating: undrop-for-innodb-master/include/my_pthread.h  
  inflating: undrop-for-innodb-master/include/my_strtoll10.c  
  inflating: undrop-for-innodb-master/include/my_sys.h  
  inflating: undrop-for-innodb-master/include/my_vsnprintf.c  
  inflating: undrop-for-innodb-master/include/my_xml.h  
  inflating: undrop-for-innodb-master/include/myisampack.h  
  inflating: undrop-for-innodb-master/include/mysql_def.h  
  inflating: undrop-for-innodb-master/include/os0file.h  
  inflating: undrop-for-innodb-master/include/os0proc.h  
  inflating: undrop-for-innodb-master/include/os0proc.ic  
  inflating: undrop-for-innodb-master/include/os0sync.h  
  inflating: undrop-for-innodb-master/include/os0sync.ic  
  inflating: undrop-for-innodb-master/include/os0thread.h  
  inflating: undrop-for-innodb-master/include/os0thread.ic  
  inflating: undrop-for-innodb-master/include/page0cur.h  
  inflating: undrop-for-innodb-master/include/page0cur.ic  
  inflating: undrop-for-innodb-master/include/page0page.h  
  inflating: undrop-for-innodb-master/include/page0page.ic  
  inflating: undrop-for-innodb-master/include/page0types.h  
  inflating: undrop-for-innodb-master/include/print_data.h  
  inflating: undrop-for-innodb-master/include/que0types.h  
  inflating: undrop-for-innodb-master/include/r_strinstr.c  
  inflating: undrop-for-innodb-master/include/raid.h  
  inflating: undrop-for-innodb-master/include/read0types.h  
  inflating: undrop-for-innodb-master/include/rem0cmp.h  
  inflating: undrop-for-innodb-master/include/rem0cmp.ic  
  inflating: undrop-for-innodb-master/include/rem0rec.h  
  inflating: undrop-for-innodb-master/include/rem0rec.ic  
  inflating: undrop-for-innodb-master/include/rem0types.h  
  inflating: undrop-for-innodb-master/include/row0types.h  
  inflating: undrop-for-innodb-master/include/srv0srv.h  
  inflating: undrop-for-innodb-master/include/str2int.c  
  inflating: undrop-for-innodb-master/include/str_alloc.c  
  inflating: undrop-for-innodb-master/include/strappend.c  
  inflating: undrop-for-innodb-master/include/strcend.c  
  inflating: undrop-for-innodb-master/include/strcont.c  
  inflating: undrop-for-innodb-master/include/strend.c  
  inflating: undrop-for-innodb-master/include/strfill.c  
  inflating: undrop-for-innodb-master/include/strinstr.c  
  inflating: undrop-for-innodb-master/include/strmake.c  
  inflating: undrop-for-innodb-master/include/strmov.c  
  inflating: undrop-for-innodb-master/include/strnlen.c  
  inflating: undrop-for-innodb-master/include/strnmov.c  
  inflating: undrop-for-innodb-master/include/strstr.c  
  inflating: undrop-for-innodb-master/include/strtod.c  
  inflating: undrop-for-innodb-master/include/strtol.c  
  inflating: undrop-for-innodb-master/include/strtoll.c  
  inflating: undrop-for-innodb-master/include/strtoul.c  
  inflating: undrop-for-innodb-master/include/strtoull.c  
  inflating: undrop-for-innodb-master/include/strxmov.c  
  inflating: undrop-for-innodb-master/include/strxnmov.c  
  inflating: undrop-for-innodb-master/include/sync0arr.h  
  inflating: undrop-for-innodb-master/include/sync0arr.ic  
  inflating: undrop-for-innodb-master/include/sync0rw.h  
  inflating: undrop-for-innodb-master/include/sync0rw.ic  
  inflating: undrop-for-innodb-master/include/sync0sync.h  
  inflating: undrop-for-innodb-master/include/sync0sync.ic  
  inflating: undrop-for-innodb-master/include/sync0types.h  
  inflating: undrop-for-innodb-master/include/tables_dict.h  
  inflating: undrop-for-innodb-master/include/trx0sys.h  
  inflating: undrop-for-innodb-master/include/trx0sys.ic  
  inflating: undrop-for-innodb-master/include/trx0trx.h  
  inflating: undrop-for-innodb-master/include/trx0trx.ic  
  inflating: undrop-for-innodb-master/include/trx0types.h  
  inflating: undrop-for-innodb-master/include/trx0undo.h  
  inflating: undrop-for-innodb-master/include/trx0undo.ic  
  inflating: undrop-for-innodb-master/include/trx0xa.h  
  inflating: undrop-for-innodb-master/include/typelib.h  
  inflating: undrop-for-innodb-master/include/univ.i  
  inflating: undrop-for-innodb-master/include/usr0types.h  
  inflating: undrop-for-innodb-master/include/ut0byte.h  
  inflating: undrop-for-innodb-master/include/ut0byte.ic  
  inflating: undrop-for-innodb-master/include/ut0dbg.h  
  inflating: undrop-for-innodb-master/include/ut0lst.h  
  inflating: undrop-for-innodb-master/include/ut0mem.h  
  inflating: undrop-for-innodb-master/include/ut0mem.ic  
  inflating: undrop-for-innodb-master/include/ut0rnd.h  
  inflating: undrop-for-innodb-master/include/ut0rnd.ic  
  inflating: undrop-for-innodb-master/include/ut0ut.h  
  inflating: undrop-for-innodb-master/include/ut0ut.ic  
  inflating: undrop-for-innodb-master/include/xml.c  
  inflating: undrop-for-innodb-master/innochecksum.c  
  inflating: undrop-for-innodb-master/print_data.c  
  inflating: undrop-for-innodb-master/recover_dictionary.sh  
   creating: undrop-for-innodb-master/sakila/
  inflating: undrop-for-innodb-master/sakila/actor.sql  
  inflating: undrop-for-innodb-master/sakila/address.sql  
  inflating: undrop-for-innodb-master/sakila/category.sql  
  inflating: undrop-for-innodb-master/sakila/city.sql  
  inflating: undrop-for-innodb-master/sakila/country.sql  
  inflating: undrop-for-innodb-master/sakila/customer.sql  
  inflating: undrop-for-innodb-master/sakila/film.sql  
  inflating: undrop-for-innodb-master/sakila/film_actor.sql  
  inflating: undrop-for-innodb-master/sakila/film_category.sql  
  inflating: undrop-for-innodb-master/sakila/inventory.sql  
  inflating: undrop-for-innodb-master/sakila/language.sql  
  inflating: undrop-for-innodb-master/sakila/payment.sql  
  inflating: undrop-for-innodb-master/sakila/rental.sql  
  inflating: undrop-for-innodb-master/sakila/sakila-db.tar.gz  
  inflating: undrop-for-innodb-master/sakila/staff.sql  
  inflating: undrop-for-innodb-master/sakila/store.sql  
  inflating: undrop-for-innodb-master/sql_parser.l  
  inflating: undrop-for-innodb-master/sql_parser.y  
  inflating: undrop-for-innodb-master/stream_parser.c  
  inflating: undrop-for-innodb-master/sys_parser.c  
  inflating: undrop-for-innodb-master/tables_dict.c  
  inflating: undrop-for-innodb-master/test.sh  

4:编译

[root@localhost /]# cd undrop-for-innodb-master
[root@localhost undrop-for-innodb-master]# ll
total 208
-rw-r--r--. 1 root root  6271 Oct  2  2015 check_data.c
-rw-r--r--. 1 root root 28689 Oct  2  2015 c_parser.c
drwxr-xr-x. 2 root root    92 Oct  2  2015 dictionary
-rw-r--r--. 1 root root  1978 Oct  2  2015 fetch_data.sh
drwxr-xr-x. 2 root root  4096 Oct  2  2015 include
-rw-r--r--. 1 root root  8936 Oct  2  2015 innochecksum.c
-rw-r--r--. 1 root root 18047 Oct  2  2015 LICENSE
-rw-r--r--. 1 root root  1816 Oct  2  2015 Makefile
-rw-r--r--. 1 root root 16585 Oct  2  2015 print_data.c
-rw-r--r--. 1 root root  3467 Oct  2  2015 README.md
-rwxr-xr-x. 1 root root  1536 Oct  2  2015 recover_dictionary.sh
drwxr-xr-x. 2 root root  4096 Oct  2  2015 sakila
-rw-r--r--. 1 root root  7244 Oct  2  2015 sql_parser.l
-rw-r--r--. 1 root root 25607 Oct  2  2015 sql_parser.y
-rw-r--r--. 1 root root 23004 Oct  2  2015 stream_parser.c
-rw-r--r--. 1 root root 14764 Oct  2  2015 sys_parser.c
-rw-r--r--. 1 root root  2237 Oct  2  2015 tables_dict.c
-rwxr-xr-x. 1 root root  6178 Oct  2  2015 test.sh
[root@localhost undrop-for-innodb-master]# make
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe  -I./include -c stream_parser.c
stream_parser.c: In function ‘valid_innodb_page’:
stream_parser.c:151:31: warning: variable ‘oldcsumfield’ set but not used [-Wunused-but-set-variable]
     unsigned int page_n_heap, oldcsumfield;
                               ^
stream_parser.c: In function ‘process_ibpage’:
stream_parser.c:313:9: warning: variable ‘sem’ set but not used [-Wunused-but-set-variable]
     int sem = (page_type == FIL_PAGE_INDEX) 
         ^
stream_parser.c: In function ‘process_ibfile’:
stream_parser.c:333:13: warning: variable ‘prev_disk_offset’ set but not used [-Wunused-but-set-variable]
     off64_t prev_disk_offset = 0;
             ^
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe  -I./include  -pthread -lm  stream_parser.o -o stream_parser
flex  sql_parser.l
bison  -o sql_parser.c sql_parser.y
sql_parser.y: warning: 6 shift/reduce conflicts [-Wconflicts-sr]
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe  -I./include -c sql_parser.c 
sql_parser.y: In function ‘yyparse’:
sql_parser.y:166:39: warning: variable ‘none’ set but not used [-Wunused-but-set-variable]
         field_def_t trx_id, roll_ptr, none;
                                       ^
In file included from sql_parser.y:660:0:
sql_parser.y: At top level:
lex.yy.c:3085:17: warning: ‘yyunput’ defined but not used [-Wunused-function]
     static void yyunput (int c, register char * yy_bp )
                 ^
lex.yy.c:3126:16: warning: ‘input’ defined but not used [-Wunused-function]
     static int input  (void)
                ^
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe  -I./include -c c_parser.c
In file included from c_parser.c:39:0:
decimal.c: In function ‘decimal_intg’:
decimal.c:1923:9: warning: variable ‘tmp_res’ set but not used [-Wunused-but-set-variable]
In file included from c_parser.c:35:0:
c_parser.c: At top level:
./include/ctype-latin1.c:359:5: warning: ‘my_mb_wc_latin1’ defined but not used [-Wunused-function]
 int my_mb_wc_latin1(CHARSET_INFO *cs  __attribute__((unused)),
     ^
./include/ctype-latin1.c:372:5: warning: ‘my_wc_mb_latin1’ defined but not used [-Wunused-function]
 int my_wc_mb_latin1(CHARSET_INFO *cs  __attribute__((unused)),
     ^
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe  -I./include -c tables_dict.c
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe  -I./include -c print_data.c
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe  -I./include -c check_data.c
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe   -I./include  sql_parser.o c_parser.o tables_dict.o print_data.o check_data.o -o c_parser -pthread -lm
cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe   -I./include -o innochecksum_changer innochecksum.c
[root@localhost undrop-for-innodb-master]# ll
total 2904
-rw-r--r--. 1 root root    6271 Oct  2  2015 check_data.c
-rw-r--r--. 1 root root   66088 Jan 17 16:59 check_data.o
-rwxr-xr-x. 1 root root  725572 Jan 17 16:59 c_parser
-rw-r--r--. 1 root root   28689 Oct  2  2015 c_parser.c
-rw-r--r--. 1 root root 1038536 Jan 17 16:59 c_parser.o
drwxr-xr-x. 2 root root      92 Oct  2  2015 dictionary
-rw-r--r--. 1 root root    1978 Oct  2  2015 fetch_data.sh
drwxr-xr-x. 2 root root    4096 Oct  2  2015 include
-rw-r--r--. 1 root root    8936 Oct  2  2015 innochecksum.c
-rwxr-xr-x. 1 root root   36399 Jan 17 16:59 innochecksum_changer
-rw-r--r--. 1 root root  134778 Jan 17 16:59 lex.yy.c
-rw-r--r--. 1 root root   18047 Oct  2  2015 LICENSE
-rw-r--r--. 1 root root    1816 Oct  2  2015 Makefile
-rw-r--r--. 1 root root   16585 Oct  2  2015 print_data.c
-rw-r--r--. 1 root root  127136 Jan 17 16:59 print_data.o
-rw-r--r--. 1 root root    3467 Oct  2  2015 README.md
-rwxr-xr-x. 1 root root    1536 Oct  2  2015 recover_dictionary.sh
drwxr-xr-x. 2 root root    4096 Oct  2  2015 sakila
-rw-r--r--. 1 root root  102053 Jan 17 16:59 sql_parser.c
-rw-r--r--. 1 root root    7244 Oct  2  2015 sql_parser.l
-rw-r--r--. 1 root root  287296 Jan 17 16:59 sql_parser.o
-rw-r--r--. 1 root root   25607 Oct  2  2015 sql_parser.y
-rwxr-xr-x. 1 root root   63657 Jan 17 16:59 stream_parser
-rw-r--r--. 1 root root   23004 Oct  2  2015 stream_parser.c
-rw-r--r--. 1 root root  114944 Jan 17 16:59 stream_parser.o
-rw-r--r--. 1 root root   14764 Oct  2  2015 sys_parser.c
-rw-r--r--. 1 root root    2237 Oct  2  2015 tables_dict.c
-rw-r--r--. 1 root root   40176 Jan 17 16:59 tables_dict.o
-rwxr-xr-x. 1 root root    6178 Oct  2  2015 test.sh
[root@localhost undrop-for-innodb-master]#  make sys_parser
/mysqlsoft/mysql/bin/mysql_config
cc -o sys_parser sys_parser.c `mysql_config --cflags` `mysql_config --libs`

5:验证
编译完成后在undrop-for-innodb 目录下生成stream_parser 和c_parser, sys_parser 文件。

[root@localhost undrop-for-innodb-master]# ll
total 2928
-rw-r--r--. 1 root root    6271 Oct  2  2015 check_data.c
-rw-r--r--. 1 root root   66088 Jan 17 16:59 check_data.o
-rwxr-xr-x. 1 root root  725572 Jan 17 16:59 c_parser
-rw-r--r--. 1 root root   28689 Oct  2  2015 c_parser.c
-rw-r--r--. 1 root root 1038536 Jan 17 16:59 c_parser.o
drwxr-xr-x. 2 root root      92 Oct  2  2015 dictionary
-rw-r--r--. 1 root root    1978 Oct  2  2015 fetch_data.sh
drwxr-xr-x. 2 root root    4096 Oct  2  2015 include
-rw-r--r--. 1 root root    8936 Oct  2  2015 innochecksum.c
-rwxr-xr-x. 1 root root   36399 Jan 17 16:59 innochecksum_changer
-rw-r--r--. 1 root root  134778 Jan 17 16:59 lex.yy.c
-rw-r--r--. 1 root root   18047 Oct  2  2015 LICENSE
-rw-r--r--. 1 root root    1816 Oct  2  2015 Makefile
-rw-r--r--. 1 root root   16585 Oct  2  2015 print_data.c
-rw-r--r--. 1 root root  127136 Jan 17 16:59 print_data.o
-rw-r--r--. 1 root root    3467 Oct  2  2015 README.md
-rwxr-xr-x. 1 root root    1536 Oct  2  2015 recover_dictionary.sh
drwxr-xr-x. 2 root root    4096 Oct  2  2015 sakila
-rw-r--r--. 1 root root  102053 Jan 17 16:59 sql_parser.c
-rw-r--r--. 1 root root    7244 Oct  2  2015 sql_parser.l
-rw-r--r--. 1 root root  287296 Jan 17 16:59 sql_parser.o
-rw-r--r--. 1 root root   25607 Oct  2  2015 sql_parser.y
-rwxr-xr-x. 1 root root   63657 Jan 17 16:59 stream_parser
-rw-r--r--. 1 root root   23004 Oct  2  2015 stream_parser.c
-rw-r--r--. 1 root root  114944 Jan 17 16:59 stream_parser.o
-rwxr-xr-x. 1 root root   20650 Jan 17 17:05 sys_parser
-rw-r--r--. 1 root root   14764 Oct  2  2015 sys_parser.c
-rw-r--r--. 1 root root    2237 Oct  2  2015 tables_dict.c
-rw-r--r--. 1 root root   40176 Jan 17 16:59 tables_dict.o
-rwxr-xr-x. 1 root root    6178 Oct  2  2015 test.sh

二.执行drop table恢复操作
1:删除表

mysql> use test
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

mysql> desc articles;
+-------+------------------+------+-----+---------+----------------+
| Field | Type             | Null | Key | Default | Extra          |
+-------+------------------+------+-----+---------+----------------+
| id    | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| title | varchar(200)     | YES  | MUL | NULL    |                |
| body  | text             | YES  |     | NULL    |                |
+-------+------------------+------+-----+---------+----------------+
3 rows in set (0.00 sec)

mysql> select * from articles;
+----+-------------------+------------------------------------------+
| id | title             | body                                     |
+----+-------------------+------------------------------------------+
|  4 | 1001 MySQL Tricks | 1. Never run mysqld as root. 2. ...      |
|  5 | MySQL vs. YourSQL | In the following database comparison ... |
|  6 | MySQL Security    | When configured properly, MySQL ...      |
+----+-------------------+------------------------------------------+
3 rows in set (0.00 sec)

[root@localhost test]# ll
total 516
-rw-r-----. 1 mysql mysql  8618 Jan 18 23:44 articles.frm
-rw-r-----. 1 mysql mysql 98304 Jan 18 23:45 articles.ibd
-rw-r-----. 1 mysql mysql    67 Mar 15  2022 db.opt
-rw-r-----. 1 mysql mysql  8554 Mar 16  2022 t2.frm
-rw-r-----. 1 mysql mysql 98304 Mar 16  2022 t2#P#p0.ibd
-rw-r-----. 1 mysql mysql 98304 Mar 16  2022 t2#P#p1.ibd
-rw-r-----. 1 mysql mysql   375 Mar 16  2022 t2#P#p2.cfg
-rw-r-----. 1 mysql mysql 98304 Mar 16  2022 t2#P#p2.ibd
-rw-r-----. 1 mysql mysql   375 Mar 16  2022 t2#P#p3.cfg
-rw-r-----. 1 mysql mysql 98304 Mar 16  2022 t2#P#p3.ibd


mysql> drop table articles;
Query OK, 0 rows affected (0.35 sec)

[root@localhost test]# ll
total 408
-rw-r-----. 1 mysql mysql    67 Mar 15  2022 db.opt
-rw-r-----. 1 mysql mysql  8554 Mar 16  2022 t2.frm
-rw-r-----. 1 mysql mysql 98304 Mar 16  2022 t2#P#p0.ibd
-rw-r-----. 1 mysql mysql 98304 Mar 16  2022 t2#P#p1.ibd
-rw-r-----. 1 mysql mysql   375 Mar 16  2022 t2#P#p2.cfg
-rw-r-----. 1 mysql mysql 98304 Mar 16  2022 t2#P#p2.ibd
-rw-r-----. 1 mysql mysql   375 Mar 16  2022 t2#P#p3.cfg
-rw-r-----. 1 mysql mysql 98304 Mar 16  2022 t2#P#p3.ibd

2:关闭数据库
立刻关闭数据库,防止磁盘内的页被覆盖,影响数据的恢复成功率

mysql> shutdown;
Query OK, 0 rows affected (0.00 sec)

[root@localhost undrop-for-innodb-master]# ps -ef | grep mysqld
root     23505  3805  0 15:42 pts/3    00:00:00 grep --color=auto mysqld

3:确认硬盘分区

[root@localhost undrop-for-innodb-master]# more /mysqlsoft/mysql/my.cnf | grep datadir
datadir=/mysqldata/mysql

[root@localhost undrop-for-innodb-master]# df -h /mysqldata/mysql
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/ol-root   72G   64G  8.0G  89% /

4:扫描硬盘分区
由于innodb_file_per_table=ON,一旦数据库drop 了某个表,该表对应的ibd 文件也会从磁盘中被删除,因此无法从ibdata 文件中恢复数据,只能从磁盘中进行恢复,因此需要扫描整个磁盘分区。

[root@localhost undrop-for-innodb-master]# ./stream_parser -f /dev/mapper/ol-root -t 72G
Opening file: /dev/mapper/ol-root
File information:

Opening file: /dev/mapper/ol-root
File information:

Opening file: /dev/mapper/ol-root
File information:

ID of device containing file:            5
ID of device containing file:            5
ID of device containing file:            5
inode number:                        10610
inode number:                        10610
inode number:                        10610
protection:                          60660 protection:                          60660 protection:                          60660 (block device)
(block device)
(block device)
number of hard links:                    1
number of hard links:                    1
number of hard links:                    1
user ID of owner:                        0
user ID of owner:                        0
user ID of owner:                        0
group ID of owner:                       6
group ID of owner:                       6
group ID of owner:                       6
device ID (if special file):         64768
device ID (if special file):         64768
device ID (if special file):         64768
blocksize for filesystem I/O:         4096
blocksize for filesystem I/O:         4096
blocksize for filesystem I/O:         4096
number of blocks allocated:              0
number of blocks allocated:              0
number of blocks allocated:              0
time of last access:            1661331760 Wed Aug 24 17:02:40 2022
time of last access:            1661331760 Wed Aug 24 17:02:40 2022
time of last access:            1661331760 Wed Aug 24 17:02:40 2022
time of last modification:      1661337281 Wed Aug 24 18:34:41 2022
time of last modification:      1661337281 Wed Aug 24 18:34:41 2022
time of last modification:      1661337281 Wed Aug 24 18:34:41 2022
time of last status change:     1661337281 Wed Aug 24 18:34:41 2022
time of last status change:     1661337281 Wed Aug 24 18:34:41 2022
time of last status change:     1661337281 Wed Aug 24 18:34:41 2022
total size, in bytes:                    0 (0.000 exp(+0))

total size, in bytes:                    0 (0.000 exp(+0))

total size, in bytes:                    0 (0.000 exp(+0))

Size to process:               77309411328 (72.000 GiB)
Size to process:               77309411328 (72.000 GiB)
Size to process:               77309411328 (72.000 GiB)
Opening file: /dev/mapper/ol-root
File information:

ID of device containing file:            5
inode number:                        10610
protection:                          60660 (block device)
number of hard links:                    1
user ID of owner:                        0
group ID of owner:                       6
device ID (if special file):         64768
blocksize for filesystem I/O:         4096
number of blocks allocated:              0
time of last access:            1661331760 Wed Aug 24 17:02:40 2022
time of last modification:      1661337281 Wed Aug 24 18:34:41 2022
time of last status change:     1661337281 Wed Aug 24 18:34:41 2022
total size, in bytes:                    0 (0.000 exp(+0))

Size to process:               77309411328 (72.000 GiB)
Worker(0): 1.08% done. 2024-01-18 23:58:28 ETA(in 00:07:55). Processing speed: 38.325 MiB/sec
Worker(2): 1.08% done. 2024-01-18 23:58:28 ETA(in 00:07:55). Processing speed: 38.328 MiB/sec
Worker(3): 1.08% done. 2024-01-19 00:00:04 ETA(in 00:09:30). Processing speed: 31.938 MiB/sec
Worker(1): 1.08% done. 2024-01-19 00:00:04 ETA(in 00:09:30). Processing speed: 31.938 MiB/sec
Worker(0): 2.12% done. 2024-01-18 23:58:28 ETA(in 00:07:50). Processing speed: 38.325 MiB/sec
Worker(2): 2.12% done. 2024-01-18 23:58:28 ETA(in 00:07:50). Processing speed: 38.325 MiB/sec
Worker(1): 2.12% done. 2024-01-18 23:56:54 ETA(in 00:06:16). Processing speed: 47.906 MiB/sec
Worker(3): 2.12% done. 2024-01-18 23:58:29 ETA(in 00:07:50). Processing speed: 38.325 MiB/sec
Worker(2): 3.16% done. 2024-01-19 00:00:02 ETA(in 00:09:18). Processing speed: 31.938 MiB/sec
Worker(1): 3.16% done. 2024-01-19 00:00:02 ETA(in 00:09:18). Processing speed: 31.938 MiB/sec
Worker(0): 3.16% done. 2024-01-19 00:00:02 ETA(in 00:09:18). Processing speed: 31.938 MiB/sec
Worker(3): 3.16% done. 2024-01-19 00:00:03 ETA(in 00:09:18). Processing speed: 31.938 MiB/sec
Worker(2): 4.20% done. 2024-01-18 23:56:56 ETA(in 00:06:08). Processing speed: 47.906 MiB/sec
Worker(1): 4.20% done. 2024-01-18 23:56:56 ETA(in 00:06:08). Processing speed: 47.910 MiB/sec
Worker(0): 4.20% done. 2024-01-19 00:00:02 ETA(in 00:09:12). Processing speed: 31.938 MiB/sec
Worker(3): 4.20% done. 2024-01-18 23:58:30 ETA(in 00:07:40). Processing speed: 38.325 MiB/sec
Worker(2): 5.24% done. 2024-01-18 23:56:56 ETA(in 00:06:04). Processing speed: 47.907 MiB/sec
Worker(1): 5.24% done. 2024-01-18 23:58:28 ETA(in 00:07:35). Processing speed: 38.326 MiB/sec
Worker(0): 5.24% done. 2024-01-18 23:58:30 ETA(in 00:07:35). Processing speed: 38.325 MiB/sec
Worker(3): 5.24% done. 2024-01-19 00:00:02 ETA(in 00:09:06). Processing speed: 31.938 MiB/sec
Worker(2): 6.28% done. 2024-01-18 23:58:27 ETA(in 00:07:30). Processing speed: 38.326 MiB/sec
Worker(1): 6.28% done. 2024-01-18 23:58:28 ETA(in 00:07:30). Processing speed: 38.325 MiB/sec
Worker(0): 6.28% done. 2024-01-18 23:58:30 ETA(in 00:07:30). Processing speed: 38.325 MiB/sec
Worker(3): 6.28% done. 2024-01-18 23:58:31 ETA(in 00:07:30). Processing speed: 38.325 MiB/sec
Worker(2): 7.32% done. 2024-01-18 23:56:57 ETA(in 00:05:56). Processing speed: 47.906 MiB/sec
Worker(1): 7.32% done. 2024-01-18 23:56:58 ETA(in 00:05:56). Processing speed: 47.911 MiB/sec
Worker(2): 8.36% done. 2024-01-18 23:56:57 ETA(in 00:05:52). Processing speed: 47.941 MiB/sec
Worker(3): 7.32% done. 2024-01-18 23:57:01 ETA(in 00:05:56). Processing speed: 47.906 MiB/sec
Worker(0): 7.32% done. 2024-01-18 23:58:30 ETA(in 00:07:25). Processing speed: 38.331 MiB/sec
Worker(1): 8.36% done. 2024-01-18 23:58:27 ETA(in 00:07:20). Processing speed: 38.327 MiB/sec
Worker(2): 9.40% done. 2024-01-18 23:58:25 ETA(in 00:07:15). Processing speed: 38.334 MiB/sec
Worker(3): 8.36% done. 2024-01-18 23:59:59 ETA(in 00:08:48). Processing speed: 31.938 MiB/sec
Worker(0): 8.36% done. 2024-01-18 23:59:59 ETA(in 00:08:48). Processing speed: 31.945 MiB/sec
Worker(1): 9.40% done. 2024-01-18 23:58:27 ETA(in 00:07:15). Processing speed: 38.328 MiB/sec
Worker(2): 10.44% done. 2024-01-18 23:58:25 ETA(in 00:07:10). Processing speed: 38.328 MiB/sec
Worker(3): 9.40% done. 2024-01-18 23:58:31 ETA(in 00:07:15). Processing speed: 38.325 MiB/sec
Worker(0): 9.40% done. 2024-01-18 23:58:31 ETA(in 00:07:15). Processing speed: 38.356 MiB/sec
Worker(1): 10.44% done. 2024-01-18 23:58:27 ETA(in 00:07:10). Processing speed: 38.325 MiB/sec
Worker(2): 11.48% done. 2024-01-18 23:56:59 ETA(in 00:05:40). Processing speed: 47.910 MiB/sec
Worker(0): 10.44% done. 2024-01-18 23:57:04 ETA(in 00:05:44). Processing speed: 47.962 MiB/sec
Worker(3): 10.44% done. 2024-01-18 23:57:04 ETA(in 00:05:44). Processing speed: 47.910 MiB/sec
Worker(1): 11.48% done. 2024-01-18 23:57:01 ETA(in 00:05:40). Processing speed: 47.914 MiB/sec
Worker(2): 12.52% done. 2024-01-18 23:55:34 ETA(in 00:04:12). Processing speed: 63.970 MiB/sec
Worker(0): 11.48% done. 2024-01-18 23:55:38 ETA(in 00:04:15). Processing speed: 63.876 MiB/sec
Worker(3): 11.48% done. 2024-01-18 23:57:04 ETA(in 00:05:40). Processing speed: 47.916 MiB/sec
Worker(2): 13.56% done. 2024-01-18 23:56:58 ETA(in 00:05:32). Processing speed: 47.930 MiB/sec
Worker(1): 12.52% done. 2024-01-18 23:58:26 ETA(in 00:07:00). Processing speed: 38.325 MiB/sec
Worker(0): 12.52% done. 2024-01-18 23:58:28 ETA(in 00:07:00). Processing speed: 38.331 MiB/sec
Worker(3): 12.52% done. 2024-01-18 23:59:54 ETA(in 00:08:24). Processing speed: 31.943 MiB/sec
Worker(1): 13.56% done. 2024-01-18 23:57:02 ETA(in 00:05:32). Processing speed: 47.906 MiB/sec
Worker(2): 14.60% done. 2024-01-18 23:56:58 ETA(in 00:05:28). Processing speed: 47.938 MiB/sec
Worker(2): 15.64% done. 2024-01-18 23:56:58 ETA(in 00:05:24). Processing speed: 47.906 MiB/sec
Worker(1): 14.60% done. 2024-01-18 23:57:02 ETA(in 00:05:28). Processing speed: 47.906 MiB/sec
Worker(3): 13.56% done. 2024-01-18 23:58:30 ETA(in 00:06:55). Processing speed: 38.325 MiB/sec
Worker(0): 13.56% done. 2024-01-19 00:02:41 ETA(in 00:11:05). Processing speed: 23.955 MiB/sec
Worker(1): 15.64% done. 2024-01-18 23:58:24 ETA(in 00:06:45). Processing speed: 38.325 MiB/sec
Worker(2): 16.68% done. 2024-01-18 23:58:19 ETA(in 00:06:40). Processing speed: 38.325 MiB/sec
Worker(3): 14.60% done. 2024-01-18 23:57:07 ETA(in 00:05:28). Processing speed: 47.906 MiB/sec
Worker(0): 14.60% done. 2024-01-18 23:58:31 ETA(in 00:06:50). Processing speed: 38.325 MiB/sec
Worker(2): 17.72% done. 2024-01-18 23:55:39 ETA(in 00:03:57). Processing speed: 63.880 MiB/sec
Worker(1): 16.68% done. 2024-01-18 23:57:03 ETA(in 00:05:20). Processing speed: 47.912 MiB/sec
Worker(3): 15.64% done. 2024-01-18 23:59:51 ETA(in 00:08:06). Processing speed: 31.940 MiB/sec
Worker(0): 15.64% done. 2024-01-18 23:57:09 ETA(in 00:05:24). Processing speed: 47.914 MiB/sec
Worker(2): 18.76% done. 2024-01-18 23:56:58 ETA(in 00:05:12). Processing speed: 47.906 MiB/sec
Worker(1): 17.72% done. 2024-01-18 23:55:43 ETA(in 00:03:57). Processing speed: 63.909 MiB/sec
Worker(3): 16.68% done. 2024-01-18 23:58:30 ETA(in 00:06:40). Processing speed: 38.335 MiB/sec
Worker(2): 19.80% done. 2024-01-18 23:56:58 ETA(in 00:05:08). Processing speed: 47.906 MiB/sec
Worker(1): 18.76% done. 2024-01-18 23:58:21 ETA(in 00:06:30). Processing speed: 38.325 MiB/sec
Worker(0): 16.68% done. 2024-01-18 23:59:51 ETA(in 00:08:00). Processing speed: 31.940 MiB/sec
Worker(2): 20.84% done. 2024-01-18 23:56:58 ETA(in 00:05:04). Processing speed: 47.953 MiB/sec
Worker(3): 17.72% done. 2024-01-18 23:57:10 ETA(in 00:05:16). Processing speed: 47.910 MiB/sec
Worker(1): 19.80% done. 2024-01-18 23:57:03 ETA(in 00:05:08). Processing speed: 47.906 MiB/sec
Worker(0): 17.72% done. 2024-01-18 23:58:31 ETA(in 00:06:35). Processing speed: 38.325 MiB/sec
Worker(2): 21.88% done. 2024-01-18 23:56:58 ETA(in 00:05:00). Processing speed: 47.906 MiB/sec
Worker(3): 18.76% done. 2024-01-18 23:57:10 ETA(in 00:05:12). Processing speed: 47.906 MiB/sec
Worker(1): 20.84% done. 2024-01-18 23:57:03 ETA(in 00:05:04). Processing speed: 47.906 MiB/sec
Worker(0): 18.76% done. 2024-01-18 23:58:31 ETA(in 00:06:30). Processing speed: 38.325 MiB/sec
Worker(2): 22.92% done. 2024-01-18 23:56:58 ETA(in 00:04:56). Processing speed: 47.906 MiB/sec
Worker(1): 21.88% done. 2024-01-18 23:57:03 ETA(in 00:05:00). Processing speed: 47.906 MiB/sec
Worker(3): 19.80% done. 2024-01-18 23:58:28 ETA(in 00:06:25). Processing speed: 38.325 MiB/sec
Worker(2): 23.96% done. 2024-01-18 23:56:58 ETA(in 00:04:52). Processing speed: 47.943 MiB/sec
Worker(0): 19.80% done. 2024-01-18 23:58:31 ETA(in 00:06:25). Processing speed: 38.331 MiB/sec
Worker(1): 22.92% done. 2024-01-18 23:57:03 ETA(in 00:04:56). Processing speed: 47.906 MiB/sec
Worker(3): 20.84% done. 2024-01-18 23:58:28 ETA(in 00:06:20). Processing speed: 38.325 MiB/sec
Worker(2): 25.00% done. 2024-01-18 23:55:45 ETA(in 00:03:36). Processing speed: 63.948 MiB/sec
Worker(1): 23.96% done. 2024-01-18 23:57:03 ETA(in 00:04:52). Processing speed: 47.914 MiB/sec
Worker(0): 20.84% done. 2024-01-18 23:59:48 ETA(in 00:07:36). Processing speed: 31.938 MiB/sec
Worker(3): 21.88% done. 2024-01-18 23:58:28 ETA(in 00:06:15). Processing speed: 38.329 MiB/sec
Worker(2): 26.04% done. 2024-01-18 23:58:09 ETA(in 00:05:55). Processing speed: 38.325 MiB/sec
Worker(1): 25.00% done. 2024-01-18 23:57:03 ETA(in 00:04:48). Processing speed: 47.945 MiB/sec
Worker(0): 21.88% done. 2024-01-18 23:58:32 ETA(in 00:06:15). Processing speed: 38.325 MiB/sec
Worker(3): 22.92% done. 2024-01-18 23:58:28 ETA(in 00:06:10). Processing speed: 38.325 MiB/sec
Worker(2): 27.08% done. 2024-01-18 23:56:58 ETA(in 00:04:40). Processing speed: 47.914 MiB/sec
Worker(1): 26.04% done. 2024-01-18 23:57:03 ETA(in 00:04:44). Processing speed: 47.906 MiB/sec
Worker(0): 22.92% done. 2024-01-18 23:57:17 ETA(in 00:04:56). Processing speed: 47.910 MiB/sec
Worker(3): 23.96% done. 2024-01-18 23:58:28 ETA(in 00:06:05). Processing speed: 38.325 MiB/sec
Worker(2): 28.12% done. 2024-01-18 23:58:08 ETA(in 00:05:45). Processing speed: 38.332 MiB/sec
Worker(1): 27.08% done. 2024-01-18 23:57:03 ETA(in 00:04:40). Processing speed: 47.906 MiB/sec
Worker(0): 23.96% done. 2024-01-18 23:58:31 ETA(in 00:06:05). Processing speed: 38.325 MiB/sec
Worker(3): 25.00% done. 2024-01-18 23:57:15 ETA(in 00:04:48). Processing speed: 47.910 MiB/sec
Worker(2): 29.16% done. 2024-01-18 23:56:59 ETA(in 00:04:32). Processing speed: 47.906 MiB/sec
Worker(1): 28.12% done. 2024-01-18 23:58:13 ETA(in 00:05:45). Processing speed: 38.325 MiB/sec
Worker(0): 25.00% done. 2024-01-18 23:57:18 ETA(in 00:04:48). Processing speed: 47.906 MiB/sec
Worker(3): 26.04% done. 2024-01-18 23:58:27 ETA(in 00:05:55). Processing speed: 38.325 MiB/sec
Worker(1): 29.16% done. 2024-01-18 23:57:04 ETA(in 00:04:32). Processing speed: 47.906 MiB/sec
Worker(2): 30.20% done. 2024-01-18 23:59:15 ETA(in 00:06:42). Processing speed: 31.938 MiB/sec
Worker(0): 26.04% done. 2024-01-18 23:58:30 ETA(in 00:05:55). Processing speed: 38.333 MiB/sec
Worker(3): 27.07% done. 2024-01-18 23:57:16 ETA(in 00:04:40). Processing speed: 47.907 MiB/sec
Worker(1): 30.20% done. 2024-01-18 23:58:12 ETA(in 00:05:35). Processing speed: 38.326 MiB/sec
Worker(2): 31.24% done. 2024-01-18 23:57:01 ETA(in 00:04:24). Processing speed: 47.906 MiB/sec
Worker(0): 27.08% done. 2024-01-18 23:57:19 ETA(in 00:04:40). Processing speed: 47.953 MiB/sec
Worker(3): 28.11% done. 2024-01-18 23:58:26 ETA(in 00:05:45). Processing speed: 38.325 MiB/sec
Worker(1): 31.23% done. 2024-01-18 23:58:12 ETA(in 00:05:30). Processing speed: 38.325 MiB/sec
Worker(2): 32.28% done. 2024-01-18 23:59:13 ETA(in 00:06:30). Processing speed: 31.938 MiB/sec
Worker(0): 28.12% done. 2024-01-18 23:58:29 ETA(in 00:05:45). Processing speed: 38.325 MiB/sec
Worker(3): 29.16% done. 2024-01-18 23:57:17 ETA(in 00:04:32). Processing speed: 47.965 MiB/sec
Worker(1): 32.27% done. 2024-01-18 23:57:06 ETA(in 00:04:20). Processing speed: 47.906 MiB/sec
Worker(2): 33.32% done. 2024-01-18 23:57:03 ETA(in 00:04:16). Processing speed: 47.911 MiB/sec
Worker(3): 30.20% done. 2024-01-18 23:57:17 ETA(in 00:04:28). Processing speed: 47.922 MiB/sec
Worker(0): 29.16% done. 2024-01-18 23:58:29 ETA(in 00:05:40). Processing speed: 38.325 MiB/sec
Worker(1): 33.31% done. 2024-01-18 23:57:06 ETA(in 00:04:16). Processing speed: 47.906 MiB/sec
Worker(2): 34.36% done. 2024-01-18 23:55:59 ETA(in 00:03:09). Processing speed: 63.932 MiB/sec
Worker(3): 31.24% done. 2024-01-18 23:57:17 ETA(in 00:04:24). Processing speed: 47.906 MiB/sec
Worker(2): 35.40% done. 2024-01-18 23:57:02 ETA(in 00:04:08). Processing speed: 47.922 MiB/sec
Worker(1): 34.35% done. 2024-01-18 23:57:06 ETA(in 00:04:12). Processing speed: 47.906 MiB/sec
Worker(0): 30.20% done. 2024-01-18 23:59:37 ETA(in 00:06:42). Processing speed: 31.942 MiB/sec
Worker(3): 32.27% done. 2024-01-18 23:59:29 ETA(in 00:06:30). Processing speed: 31.938 MiB/sec
Worker(2): 36.44% done. 2024-01-18 23:58:04 ETA(in 00:05:05). Processing speed: 38.325 MiB/sec
Worker(1): 35.39% done. 2024-01-18 23:58:09 ETA(in 00:05:10). Processing speed: 38.328 MiB/sec
Worker(0): 31.24% done. 2024-01-19 00:00:44 ETA(in 00:07:42). Processing speed: 27.377 MiB/sec
Worker(3): 33.31% done. 2024-01-18 23:57:19 ETA(in 00:04:16). Processing speed: 47.906 MiB/sec
Worker(1): 36.43% done. 2024-01-18 23:57:07 ETA(in 00:04:04). Processing speed: 47.906 MiB/sec
Worker(2): 37.48% done. 2024-01-18 23:58:04 ETA(in 00:05:00). Processing speed: 38.325 MiB/sec
Worker(1): 37.47% done. 2024-01-18 23:57:07 ETA(in 00:04:00). Processing speed: 47.945 MiB/sec
Worker(2): 38.52% done. 2024-01-18 23:57:04 ETA(in 00:03:56). Processing speed: 47.906 MiB/sec
Worker(3): 34.35% done. 2024-01-18 23:58:23 ETA(in 00:05:15). Processing speed: 38.325 MiB/sec
Worker(0): 32.28% done. 2024-01-18 23:59:38 ETA(in 00:06:30). Processing speed: 31.938 MiB/sec
Worker(1): 38.51% done. 2024-01-18 23:56:07 ETA(in 00:02:57). Processing speed: 63.979 MiB/sec
Worker(3): 35.40% done. 2024-01-18 23:56:17 ETA(in 00:03:06). Processing speed: 64.000 MiB/sec
Worker(2): 39.56% done. 2024-01-18 23:56:05 ETA(in 00:02:54). Processing speed: 63.875 MiB/sec
Worker(1): 39.56% done. 2024-01-18 23:56:07 ETA(in 00:02:54). Processing speed: 63.932 MiB/sec
Worker(0): 33.32% done. 2024-01-18 23:58:33 ETA(in 00:05:20). Processing speed: 38.325 MiB/sec
Worker(3): 36.44% done. 2024-01-18 23:55:15 ETA(in 00:02:02). Processing speed: 96.000 MiB/sec
Worker(2): 40.60% done. 2024-01-18 23:56:05 ETA(in 00:02:51). Processing speed: 63.875 MiB/sec
Worker(3): 37.48% done. 2024-01-18 23:55:15 ETA(in 00:02:00). Processing speed: 96.000 MiB/sec
Worker(1): 40.60% done. 2024-01-18 23:55:09 ETA(in 00:01:54). Processing speed: 96.000 MiB/sec
Worker(0): 34.36% done. 2024-01-18 23:57:29 ETA(in 00:04:12). Processing speed: 47.906 MiB/sec
Worker(3): 38.52% done. 2024-01-18 23:55:15 ETA(in 00:01:58). Processing speed: 96.000 MiB/sec
Worker(1): 41.64% done. 2024-01-18 23:55:09 ETA(in 00:01:52). Processing speed: 96.000 MiB/sec
Worker(2): 41.64% done. 2024-01-18 23:56:05 ETA(in 00:02:48). Processing speed: 63.875 MiB/sec
Worker(3): 39.56% done. 2024-01-18 23:55:15 ETA(in 00:01:56). Processing speed: 96.000 MiB/sec
Worker(1): 42.68% done. 2024-01-18 23:56:05 ETA(in 00:02:45). Processing speed: 64.000 MiB/sec
Worker(0): 35.40% done. 2024-01-18 23:57:29 ETA(in 00:04:08). Processing speed: 47.906 MiB/sec
Worker(3): 40.60% done. 2024-01-18 23:55:15 ETA(in 00:01:54). Processing speed: 96.000 MiB/sec
Worker(2): 42.68% done. 2024-01-18 23:57:57 ETA(in 00:04:35). Processing speed: 38.325 MiB/sec
Worker(1): 43.72% done. 2024-01-18 23:55:10 ETA(in 00:01:48). Processing speed: 96.000 MiB/sec
Worker(3): 41.65% done. 2024-01-18 23:54:18 ETA(in 00:00:56). Processing speed: 192.000 MiB/sec
Worker(1): 44.76% done. 2024-01-18 23:54:16 ETA(in 00:00:53). Processing speed: 192.000 MiB/sec
Worker(3): 42.69% done. 2024-01-18 23:54:18 ETA(in 00:00:55). Processing speed: 192.000 MiB/sec
Worker(0): 36.44% done. 2024-01-18 23:55:25 ETA(in 00:02:02). Processing speed: 95.898 MiB/sec
Worker(1): 46.37% done. 2024-01-18 23:53:57 ETA(in 00:00:33). Processing speed: 296.000 MiB/sec
Worker(3): 43.73% done. 2024-01-18 23:54:18 ETA(in 00:00:54). Processing speed: 192.000 MiB/sec
Worker(0): 37.48% done. 2024-01-18 23:54:24 ETA(in 00:01:00). Processing speed: 191.984 MiB/sec
Worker(2): 43.72% done. 2024-01-18 23:55:12 ETA(in 00:01:48). Processing speed: 95.813 MiB/sec
Worker(1): 48.32% done. 2024-01-18 23:53:51 ETA(in 00:00:26). Processing speed: 360.000 MiB/sec
Worker(3): 45.03% done. 2024-01-18 23:54:07 ETA(in 00:00:42). Processing speed: 240.000 MiB/sec
Worker(0): 38.52% done. 2024-01-18 23:54:24 ETA(in 00:00:59). Processing speed: 192.000 MiB/sec
Worker(0): 39.69% done. 2024-01-18 23:54:17 ETA(in 00:00:51). Processing speed: 216.000 MiB/sec
Worker(1): 49.54% done. 2024-01-18 23:54:07 ETA(in 00:00:41). Processing speed: 224.000 MiB/sec
Worker(3): 46.29% done. 2024-01-18 23:54:08 ETA(in 00:00:42). Processing speed: 232.000 MiB/sec
Worker(2): 44.76% done. 2024-01-18 23:55:12 ETA(in 00:01:46). Processing speed: 95.813 MiB/sec
Worker(3): 47.33% done. 2024-01-18 23:54:17 ETA(in 00:00:50). Processing speed: 192.000 MiB/sec
Worker(0): 40.73% done. 2024-01-18 23:54:23 ETA(in 00:00:56). Processing speed: 192.000 MiB/sec
Worker(1): 50.58% done. 2024-01-18 23:54:14 ETA(in 00:00:47). Processing speed: 192.000 MiB/sec
Worker(2): 45.80% done. 2024-01-18 23:55:12 ETA(in 00:01:44). Processing speed: 95.813 MiB/sec
Worker(3): 48.37% done. 2024-01-18 23:54:17 ETA(in 00:00:49). Processing speed: 192.000 MiB/sec
Worker(0): 41.77% done. 2024-01-18 23:54:23 ETA(in 00:00:55). Processing speed: 192.000 MiB/sec
Worker(1): 51.62% done. 2024-01-18 23:54:14 ETA(in 00:00:46). Processing speed: 192.000 MiB/sec
Worker(3): 49.41% done. 2024-01-18 23:54:17 ETA(in 00:00:48). Processing speed: 192.000 MiB/sec
Worker(0): 42.82% done. 2024-01-18 23:55:19 ETA(in 00:01:49). Processing speed: 96.000 MiB/sec
Worker(1): 52.66% done. 2024-01-18 23:55:00 ETA(in 00:01:30). Processing speed: 96.000 MiB/sec
Worker(2): 46.84% done. 2024-01-18 23:55:12 ETA(in 00:01:42). Processing speed: 95.813 MiB/sec
Worker(3): 50.46% done. 2024-01-18 23:54:17 ETA(in 00:00:47). Processing speed: 192.000 MiB/sec
Worker(0): 43.86% done. 2024-01-18 23:54:24 ETA(in 00:00:53). Processing speed: 192.000 MiB/sec
Worker(1): 53.70% done. 2024-01-18 23:54:15 ETA(in 00:00:44). Processing speed: 192.000 MiB/sec
Worker(3): 51.50% done. 2024-01-18 23:54:17 ETA(in 00:00:46). Processing speed: 192.000 MiB/sec
Worker(1): 54.75% done. 2024-01-18 23:54:15 ETA(in 00:00:43). Processing speed: 192.000 MiB/sec
Worker(0): 44.90% done. 2024-01-18 23:54:24 ETA(in 00:00:52). Processing speed: 192.000 MiB/sec
Worker(3): 52.54% done. 2024-01-18 23:54:17 ETA(in 00:00:45). Processing speed: 192.000 MiB/sec
Worker(2): 47.88% done. 2024-01-18 23:55:12 ETA(in 00:01:40). Processing speed: 95.813 MiB/sec
Worker(1): 55.79% done. 2024-01-18 23:54:15 ETA(in 00:00:42). Processing speed: 192.000 MiB/sec
Worker(3): 53.58% done. 2024-01-18 23:55:03 ETA(in 00:01:29). Processing speed: 96.000 MiB/sec
Worker(0): 45.94% done. 2024-01-18 23:55:17 ETA(in 00:01:43). Processing speed: 96.000 MiB/sec
Worker(2): 48.92% done. 2024-01-18 23:56:02 ETA(in 00:02:27). Processing speed: 63.875 MiB/sec
Worker(1): 56.83% done. 2024-01-18 23:54:57 ETA(in 00:01:22). Processing speed: 96.000 MiB/sec
Worker(3): 54.62% done. 2024-01-18 23:54:18 ETA(in 00:00:43). Processing speed: 192.000 MiB/sec
Worker(0): 46.98% done. 2024-01-18 23:54:25 ETA(in 00:00:50). Processing speed: 192.000 MiB/sec
Worker(1): 57.91% done. 2024-01-18 23:54:14 ETA(in 00:00:38). Processing speed: 200.000 MiB/sec
Worker(3): 55.71% done. 2024-01-18 23:54:16 ETA(in 00:00:40). Processing speed: 200.000 MiB/sec
Worker(2): 49.96% done. 2024-01-18 23:54:24 ETA(in 00:00:48). Processing speed: 191.937 MiB/sec
Worker(0): 48.02% done. 2024-01-18 23:54:25 ETA(in 00:00:49). Processing speed: 192.000 MiB/sec
Worker(1): 59.52% done. 2024-01-18 23:54:02 ETA(in 00:00:25). Processing speed: 296.000 MiB/sec
Worker(3): 56.79% done. 2024-01-18 23:54:16 ETA(in 00:00:39). Processing speed: 200.000 MiB/sec
Worker(2): 51.43% done. 2024-01-18 23:54:09 ETA(in 00:00:32). Processing speed: 272.000 MiB/sec
Worker(0): 49.07% done. 2024-01-18 23:54:25 ETA(in 00:00:48). Processing speed: 192.000 MiB/sec
Worker(1): 61.13% done. 2024-01-18 23:54:02 ETA(in 00:00:24). Processing speed: 296.000 MiB/sec
Worker(2): 52.95% done. 2024-01-18 23:54:08 ETA(in 00:00:30). Processing speed: 280.000 MiB/sec
Worker(3): 57.92% done. 2024-01-18 23:54:15 ETA(in 00:00:37). Processing speed: 208.000 MiB/sec
Worker(0): 50.24% done. 2024-01-18 23:54:20 ETA(in 00:00:42). Processing speed: 216.000 MiB/sec
Worker(2): 53.99% done. 2024-01-18 23:54:23 ETA(in 00:00:44). Processing speed: 192.000 MiB/sec
Worker(1): 62.17% done. 2024-01-18 23:54:15 ETA(in 00:00:36). Processing speed: 192.000 MiB/sec
Worker(3): 58.96% done. 2024-01-18 23:54:18 ETA(in 00:00:39). Processing speed: 192.000 MiB/sec
Worker(0): 51.28% done. 2024-01-18 23:54:25 ETA(in 00:00:46). Processing speed: 192.000 MiB/sec
Worker(2): 55.03% done. 2024-01-18 23:54:23 ETA(in 00:00:43). Processing speed: 192.000 MiB/sec
Worker(1): 63.21% done. 2024-01-18 23:54:15 ETA(in 00:00:35). Processing speed: 192.000 MiB/sec
Worker(0): 52.32% done. 2024-01-18 23:54:25 ETA(in 00:00:45). Processing speed: 192.000 MiB/sec
Worker(3): 60.01% done. 2024-01-18 23:54:18 ETA(in 00:00:38). Processing speed: 192.000 MiB/sec
Worker(1): 64.86% done. 2024-01-18 23:54:02 ETA(in 00:00:21). Processing speed: 304.000 MiB/sec
Worker(2): 56.42% done. 2024-01-18 23:54:12 ETA(in 00:00:31). Processing speed: 256.000 MiB/sec
Worker(0): 53.36% done. 2024-01-18 23:54:25 ETA(in 00:00:44). Processing speed: 192.000 MiB/sec
Worker(3): 61.05% done. 2024-01-18 23:54:18 ETA(in 00:00:37). Processing speed: 192.000 MiB/sec
Worker(0): 54.71% done. 2024-01-18 23:54:15 ETA(in 00:00:33). Processing speed: 248.000 MiB/sec
Worker(1): 66.25% done. 2024-01-18 23:54:06 ETA(in 00:00:24). Processing speed: 256.000 MiB/sec
Worker(3): 62.26% done. 2024-01-18 23:54:13 ETA(in 00:00:31). Processing speed: 224.000 MiB/sec
Worker(2): 57.94% done. 2024-01-18 23:54:09 ETA(in 00:00:27). Processing speed: 280.000 MiB/sec
Worker(2): 59.46% done. 2024-01-18 23:54:09 ETA(in 00:00:26). Processing speed: 280.000 MiB/sec
Worker(0): 56.05% done. 2024-01-18 23:54:15 ETA(in 00:00:32). Processing speed: 248.000 MiB/sec
Worker(1): 67.55% done. 2024-01-18 23:54:07 ETA(in 00:00:24). Processing speed: 240.000 MiB/sec
Worker(3): 63.78% done. 2024-01-18 23:54:06 ETA(in 00:00:23). Processing speed: 280.000 MiB/sec
Worker(1): 69.29% done. 2024-01-18 23:54:01 ETA(in 00:00:17). Processing speed: 320.000 MiB/sec
Worker(3): 65.47% done. 2024-01-18 23:54:04 ETA(in 00:00:20). Processing speed: 312.000 MiB/sec
Worker(0): 57.23% done. 2024-01-18 23:54:20 ETA(in 00:00:36). Processing speed: 216.000 MiB/sec
Worker(2): 60.85% done. 2024-01-18 23:54:12 ETA(in 00:00:28). Processing speed: 256.000 MiB/sec
Worker(0): 58.40% done. 2024-01-18 23:54:20 ETA(in 00:00:35). Processing speed: 216.000 MiB/sec
Worker(3): 67.25% done. 2024-01-18 23:54:03 ETA(in 00:00:18). Processing speed: 328.000 MiB/sec
Worker(1): 71.11% done. 2024-01-18 23:54:00 ETA(in 00:00:15). Processing speed: 336.000 MiB/sec
Worker(2): 62.02% done. 2024-01-18 23:54:17 ETA(in 00:00:32). Processing speed: 216.000 MiB/sec
Worker(2): 63.50% done. 2024-01-18 23:54:10 ETA(in 00:00:24). Processing speed: 272.000 MiB/sec
Worker(0): 60.13% done. 2024-01-18 23:54:08 ETA(in 00:00:22). Processing speed: 320.000 MiB/sec
Worker(3): 69.12% done. 2024-01-18 23:54:02 ETA(in 00:00:16). Processing speed: 344.000 MiB/sec
Worker(1): 72.24% done. 2024-01-18 23:54:10 ETA(in 00:00:24). Processing speed: 208.000 MiB/sec
Worker(0): 61.65% done. 2024-01-18 23:54:12 ETA(in 00:00:25). Processing speed: 280.000 MiB/sec
Worker(3): 70.77% done. 2024-01-18 23:54:04 ETA(in 00:00:17). Processing speed: 304.000 MiB/sec
Worker(2): 64.97% done. 2024-01-18 23:54:10 ETA(in 00:00:23). Processing speed: 272.000 MiB/sec
Worker(1): 73.58% done. 2024-01-18 23:54:06 ETA(in 00:00:19). Processing speed: 248.000 MiB/sec
Worker(0): 63.35% done. 2024-01-18 23:54:09 ETA(in 00:00:21). Processing speed: 312.000 MiB/sec
Worker(3): 72.37% done. 2024-01-18 23:54:05 ETA(in 00:00:17). Processing speed: 296.000 MiB/sec
Worker(2): 66.58% done. 2024-01-18 23:54:08 ETA(in 00:00:20). Processing speed: 296.000 MiB/sec
Worker(1): 75.19% done. 2024-01-18 23:54:03 ETA(in 00:00:15). Processing speed: 296.000 MiB/sec
Worker(0): 64.95% done. 2024-01-18 23:54:10 ETA(in 00:00:21). Processing speed: 296.000 MiB/sec
Worker(2): 68.36% done. 2024-01-18 23:54:06 ETA(in 00:00:17). Processing speed: 328.000 MiB/sec
Worker(1): 76.71% done. 2024-01-18 23:54:04 ETA(in 00:00:15). Processing speed: 280.000 MiB/sec
Worker(3): 73.98% done. 2024-01-18 23:54:05 ETA(in 00:00:16). Processing speed: 296.000 MiB/sec
Worker(3): 75.76% done. 2024-01-18 23:54:03 ETA(in 00:00:13). Processing speed: 328.000 MiB/sec
Worker(1): 78.05% done. 2024-01-18 23:54:06 ETA(in 00:00:16). Processing speed: 248.000 MiB/sec
Worker(0): 66.56% done. 2024-01-18 23:54:10 ETA(in 00:00:20). Processing speed: 296.000 MiB/sec
Worker(2): 70.18% done. 2024-01-18 23:54:06 ETA(in 00:00:16). Processing speed: 336.000 MiB/sec
Worker(3): 77.50% done. 2024-01-18 23:54:03 ETA(in 00:00:12). Processing speed: 320.000 MiB/sec
Worker(1): 79.57% done. 2024-01-18 23:54:04 ETA(in 00:00:13). Processing speed: 280.000 MiB/sec
Worker(0): 67.99% done. 2024-01-18 23:54:13 ETA(in 00:00:22). Processing speed: 264.000 MiB/sec
Worker(2): 71.92% done. 2024-01-18 23:54:07 ETA(in 00:00:16). Processing speed: 320.000 MiB/sec
Worker(3): 79.28% done. 2024-01-18 23:54:03 ETA(in 00:00:11). Processing speed: 328.000 MiB/sec
Worker(1): 81.22% done. 2024-01-18 23:54:03 ETA(in 00:00:11). Processing speed: 304.000 MiB/sec
Worker(2): 73.70% done. 2024-01-18 23:54:06 ETA(in 00:00:14). Processing speed: 328.000 MiB/sec
Worker(0): 69.29% done. 2024-01-18 23:54:15 ETA(in 00:00:23). Processing speed: 240.000 MiB/sec
Worker(2): 75.26% done. 2024-01-18 23:54:08 ETA(in 00:00:15). Processing speed: 288.000 MiB/sec
Worker(1): 82.91% done. 2024-01-18 23:54:03 ETA(in 00:00:10). Processing speed: 312.000 MiB/sec
Worker(3): 80.71% done. 2024-01-18 23:54:06 ETA(in 00:00:13). Processing speed: 264.000 MiB/sec
Worker(0): 70.81% done. 2024-01-18 23:54:12 ETA(in 00:00:19). Processing speed: 280.000 MiB/sec
Worker(1): 84.52% done. 2024-01-18 23:54:03 ETA(in 00:00:09). Processing speed: 296.000 MiB/sec
Worker(2): 76.91% done. 2024-01-18 23:54:08 ETA(in 00:00:14). Processing speed: 304.000 MiB/sec
Worker(3): 82.31% done. 2024-01-18 23:54:05 ETA(in 00:00:11). Processing speed: 296.000 MiB/sec
Worker(0): 72.37% done. 2024-01-18 23:54:11 ETA(in 00:00:17). Processing speed: 288.000 MiB/sec
Worker(3): 83.75% done. 2024-01-18 23:54:06 ETA(in 00:00:11). Processing speed: 264.000 MiB/sec
Worker(1): 86.43% done. 2024-01-18 23:54:02 ETA(in 00:00:07). Processing speed: 352.000 MiB/sec
Worker(0): 73.94% done. 2024-01-18 23:54:11 ETA(in 00:00:16). Processing speed: 288.000 MiB/sec
Worker(2): 78.30% done. 2024-01-18 23:54:10 ETA(in 00:00:15). Processing speed: 256.000 MiB/sec
Worker(2): 79.69% done. 2024-01-18 23:54:10 ETA(in 00:00:14). Processing speed: 256.000 MiB/sec
Worker(1): 88.38% done. 2024-01-18 23:54:01 ETA(in 00:00:05). Processing speed: 360.000 MiB/sec
Worker(3): 85.22% done. 2024-01-18 23:54:06 ETA(in 00:00:10). Processing speed: 272.000 MiB/sec
Worker(0): 75.33% done. 2024-01-18 23:54:13 ETA(in 00:00:17). Processing speed: 256.000 MiB/sec
Worker(2): 81.12% done. 2024-01-18 23:54:10 ETA(in 00:00:13). Processing speed: 264.000 MiB/sec
Worker(0): 77.15% done. 2024-01-18 23:54:09 ETA(in 00:00:12). Processing speed: 336.000 MiB/sec
Worker(1): 90.21% done. 2024-01-18 23:54:02 ETA(in 00:00:05). Processing speed: 336.000 MiB/sec
Worker(3): 86.44% done. 2024-01-18 23:54:08 ETA(in 00:00:11). Processing speed: 224.000 MiB/sec
Worker(0): 79.10% done. 2024-01-18 23:54:08 ETA(in 00:00:10). Processing speed: 360.000 MiB/sec
Worker(3): 88.04% done. 2024-01-18 23:54:05 ETA(in 00:00:07). Processing speed: 296.000 MiB/sec
Worker(1): 91.51% done. 2024-01-18 23:54:04 ETA(in 00:00:06). Processing speed: 240.000 MiB/sec
Worker(2): 82.60% done. 2024-01-18 23:54:09 ETA(in 00:00:11). Processing speed: 272.000 MiB/sec
Worker(0): 80.40% done. 2024-01-18 23:54:14 ETA(in 00:00:15). Processing speed: 240.000 MiB/sec
Worker(1): 92.98% done. 2024-01-18 23:54:03 ETA(in 00:00:04). Processing speed: 272.000 MiB/sec
Worker(3): 89.65% done. 2024-01-18 23:54:05 ETA(in 00:00:06). Processing speed: 296.000 MiB/sec
Worker(2): 84.29% done. 2024-01-18 23:54:08 ETA(in 00:00:09). Processing speed: 312.000 MiB/sec
Worker(1): 94.59% done. 2024-01-18 23:54:03 ETA(in 00:00:03). Processing speed: 296.000 MiB/sec
Worker(3): 91.12% done. 2024-01-18 23:54:06 ETA(in 00:00:06). Processing speed: 272.000 MiB/sec
Worker(2): 86.02% done. 2024-01-18 23:54:08 ETA(in 00:00:08). Processing speed: 320.000 MiB/sec
Worker(0): 81.88% done. 2024-01-18 23:54:12 ETA(in 00:00:12). Processing speed: 272.000 MiB/sec
Worker(2): 87.37% done. 2024-01-18 23:54:10 ETA(in 00:00:09). Processing speed: 248.000 MiB/sec
Worker(1): 96.33% done. 2024-01-18 23:54:03 ETA(in 00:00:02). Processing speed: 320.000 MiB/sec
Worker(0): 83.18% done. 2024-01-18 23:54:13 ETA(in 00:00:12). Processing speed: 240.000 MiB/sec
Worker(3): 92.86% done. 2024-01-18 23:54:05 ETA(in 00:00:04). Processing speed: 320.000 MiB/sec
Worker(2): 89.32% done. 2024-01-18 23:54:07 ETA(in 00:00:05). Processing speed: 360.000 MiB/sec
Worker(3): 94.60% done. 2024-01-18 23:54:05 ETA(in 00:00:03). Processing speed: 320.000 MiB/sec
Worker(1): 97.98% done. 2024-01-18 23:54:03 ETA(in 00:00:01). Processing speed: 304.000 MiB/sec
Worker(0): 84.22% done. 2024-01-18 23:54:17 ETA(in 00:00:15). Processing speed: 192.000 MiB/sec
Worker(0): 85.74% done. 2024-01-18 23:54:12 ETA(in 00:00:09). Processing speed: 280.000 MiB/sec
Worker(2): 91.28% done. 2024-01-18 23:54:07 ETA(in 00:00:04). Processing speed: 360.000 MiB/sec
Worker(3): 95.90% done. 2024-01-18 23:54:06 ETA(in 00:00:03). Processing speed: 240.000 MiB/sec
Worker(1): 99.02% done. 2024-01-18 23:54:03 ETA(in 00:00:00). Processing speed: 191.922 MiB/sec
Worker(2): 92.93% done. 2024-01-18 23:54:08 ETA(in 00:00:04). Processing speed: 304.000 MiB/sec
Worker(0): 87.56% done. 2024-01-18 23:54:10 ETA(in 00:00:06). Processing speed: 336.000 MiB/sec
Worker(0): 89.86% done. 2024-01-18 23:54:09 ETA(in 00:00:04). Processing speed: 424.000 MiB/sec
Worker(2): 95.14% done. 2024-01-18 23:54:07 ETA(in 00:00:02). Processing speed: 408.000 MiB/sec
Worker(2): 97.48% done. 2024-01-18 23:54:07 ETA(in 00:00:01). Processing speed: 432.000 MiB/sec
Worker(0): 92.17% done. 2024-01-18 23:54:09 ETA(in 00:00:03). Processing speed: 424.000 MiB/sec
Worker(0): 94.77% done. 2024-01-18 23:54:09 ETA(in 00:00:02). Processing speed: 480.000 MiB/sec
Worker(2): 98.74% done. 2024-01-18 23:54:08 ETA(in 00:00:01). Processing speed: 231.814 MiB/sec
Worker(0): 97.33% done. 2024-01-18 23:54:09 ETA(in 00:00:01). Processing speed: 472.000 MiB/sec
Worker(2): 99.78% done. 2024-01-18 23:54:08 ETA(in 00:00:00). Processing speed: 191.641 MiB/sec
Worker(0): 99.46% done. 2024-01-18 23:54:09 ETA(in 00:00:00). Processing speed: 391.986 MiB/sec
All workers finished in 222 sec

运行完成后,会在当前目录下生成pages-ol-root 文件目录, 目录下按照每个页为一个文件,分为索引页和数据较大的BLOB 页,我们访问系统表的话,是存在索引页中的

5:扫描数据字典文件
./stream_parser -f /mysqldata/mysql/ibdata1
一般情况下表结构是存储在frm 文件中,drop table 会删除frm 文件,还好我们可以从innodb 系统表里读取一些信息恢复表结构。innodb 系统表有SYS_COLUMNS | SYS_FIELDS |SYS_INDEXES | SYS_TABLES。需要从系统表中恢复,而系统表是保存在$datadir/ibdata1 文件中的解析ibdata 文件,扫描出所有符合innodb 格式的数据页,结果会按照index_id 进行重新组织

[root@localhost undrop-for-innodb-master]# ./stream_parser -f /mysqldata/mysql/ibdata1
Opening file: /mysqldata/mysql/ibdata1
File information:

ID of device containing file:        64768
inode number:                      4591360
protection:                         100640 Opening file: /mysqldata/mysql/ibdata1
(regular file)
number of hard links:                    1
user ID of owner:                       27
File information:

group ID of owner:                      27
device ID (if special file):             0
blocksize for filesystem I/O:         4096
number of blocks allocated:         151560
ID of device containing file:        64768
inode number:                      4591360
protection:                         100640 (regular file)
number of hard links:                    1
user ID of owner:                       27
group ID of owner:                      27
device ID (if special file):             0
blocksize for filesystem I/O:         4096
Opening file: /mysqldata/mysql/ibdata1
number of blocks allocated:         151560
File information:

ID of device containing file:        64768
inode number:                      4591360
protection:                         100640 (regular file)
number of hard links:                    1
user ID of owner:                       27
group ID of owner:                      27
device ID (if special file):             0
blocksize for filesystem I/O:         4096
number of blocks allocated:         151560
time of last access:            1705592841 Thu Jan 18 23:47:21 2024
Opening file: /mysqldata/mysql/ibdata1
time of last modification:      1705592841 Thu Jan 18 23:47:21 2024
File information:

time of last status change:     1705592841 Thu Jan 18 23:47:21 2024
time of last access:            1705592841 Thu Jan 18 23:47:21 2024
ID of device containing file:        64768
inode number:                      4591360
total size, in bytes:             77594624 (74.000 MiB)

time of last modification:      1705592841 Thu Jan 18 23:47:21 2024
protection:                         100640 (regular file)
number of hard links:                    1
user ID of owner:                       27
time of last status change:     1705592841 Thu Jan 18 23:47:21 2024
group ID of owner:                      27
device ID (if special file):             0
blocksize for filesystem I/O:         4096
number of blocks allocated:         151560
Size to process:                  77594624 (74.000 MiB)
total size, in bytes:             77594624 (74.000 MiB)

time of last access:            1705592841 Thu Jan 18 23:47:21 2024
Size to process:                  77594624 (74.000 MiB)
time of last modification:      1705592841 Thu Jan 18 23:47:21 2024
time of last status change:     1705592841 Thu Jan 18 23:47:21 2024
total size, in bytes:             77594624 (74.000 MiB)

Size to process:                  77594624 (74.000 MiB)
time of last access:            1705592841 Thu Jan 18 23:47:21 2024
time of last modification:      1705592841 Thu Jan 18 23:47:21 2024
time of last status change:     1705592841 Thu Jan 18 23:47:21 2024
total size, in bytes:             77594624 (74.000 MiB)

Size to process:                  77594624 (74.000 MiB)
All workers finished in 0 sec




[root@localhost undrop-for-innodb-master]# cd dictionary/
[root@localhost dictionary]# ll
total 16
-rw-r--r--. 1 root root 1845 Oct  2  2015 SYS_COLUMNS.sql
-rw-r--r--. 1 root root 1685 Oct  2  2015 SYS_FIELDS.sql
-rw-r--r--. 1 root root 1876 Oct  2  2015 SYS_INDEXES.sql
-rw-r--r--. 1 root root 1895 Oct  2  2015 SYS_TABLES.sql

[root@localhost undrop-for-innodb-master]# cd pages-ibdata1
[root@localhost pages-ibdata1]# ll
total 4
drwxr-xr-x. 2 root root 4096 Jan 19 00:03 FIL_PAGE_INDEX
drwxr-xr-x. 2 root root    6 Jan 19 00:03 FIL_PAGE_TYPE_BLOB

[root@localhost pages-ibdata1]# cd FIL_PAGE_INDEX
[root@localhost FIL_PAGE_INDEX]# ll
total 1312
-rw-r--r--. 1 root root  32768 Jan 19 00:03 0000000000000001.page
-rw-r--r--. 1 root root  16384 Jan 19 00:03 0000000000000002.page
-rw-r--r--. 1 root root  16384 Jan 19 00:03 0000000000000003.page
-rw-r--r--. 1 root root  16384 Jan 19 00:03 0000000000000004.page
-rw-r--r--. 1 root root  32768 Jan 19 00:03 0000000000000005.page
-rw-r--r--. 1 root root  16384 Jan 19 00:03 0000000000000011.page
-rw-r--r--. 1 root root  16384 Jan 19 00:03 0000000000000012.page
-rw-r--r--. 1 root root  16384 Jan 19 00:03 0000000000000013.page
-rw-r--r--. 1 root root  16384 Jan 19 00:03 0000000000000014.page
-rw-r--r--. 1 root root  32768 Jan 19 00:03 0000000000000015.page
-rw-r--r--. 1 root root  32768 Jan 19 00:03 0000000000000016.page
-rw-r--r--. 1 root root  16384 Jan 19 00:03 0000000000000017.page
-rw-r--r--. 1 root root 475136 Jan 19 00:03 0000000000000025.page
-rw-r--r--. 1 root root  49152 Jan 19 00:03 0000000000000026.page
-rw-r--r--. 1 root root  16384 Jan 19 00:03 0000000000000027.page
-rw-r--r--. 1 root root  16384 Jan 19 00:03 0000000000000047.page
-rw-r--r--. 1 root root  16384 Jan 19 00:03 18446744069414584320.page

6:解析数据字典表
被删除表的数据字典信息由于数据字典是存放在ibdata 文件中,通过上面的stream_parser 解析出来的数据页,是按照index_id 排序组织的,其中01 是SYS_TABLES,02 是SYS_COLUMNS,03 是SYS_INDEXES,04 是SYS_FIELDS。解析对应的page,获取对应的表结构信息。

这里有个地方需要注意,就是这个输出的文件路径./dumps/default,这是工具里代码固定的,因此在此步骤之前我们必须要创建这个目录$BASEDIR/dumps/default

[root@localhost undrop-for-innodb-master]# mkdir -p dumps/default

[root@localhost undrop-for-innodb-master]# ./c_parser -4Df pages-ibdata1/FIL_PAGE_INDEX/0000000000000001.page -t dictionary/SYS_TABLES.sql >./dumps/default/SYS_TABLES 2>./dumps/default/SYS_TABLES.sql;

[root@localhost undrop-for-innodb-master]# ./c_parser -4Df pages-ibdata1/FIL_PAGE_INDEX/0000000000000003.page -t dictionary/SYS_INDEXES.sql >./dumps/default/SYS_INDEXES 2>./dumps/default/SYS_INDEXES.sql;

[root@localhost undrop-for-innodb-master]# ./c_parser -4Df pages-ibdata1/FIL_PAGE_INDEX/0000000000000002.page -t dictionary/SYS_COLUMNS.sql>./dumps/default/SYS_COLUMNS 2>./dumps/default/SYS_COLUMNS.sql;

[root@localhost undrop-for-innodb-master]# ./c_parser -4Df pages-ibdata1/FIL_PAGE_INDEX/0000000000000004.page -t dictionary/SYS_FIELDS.sql >./dumps/default/SYS_FIELDS 2>./dumps/default/SYS_FIELDS.sql;

7:查看相应的数据字典信息
带有.sql 后缀的是根据表结构生成的load data 语句,其中load 语句中需要加载的文件就是不带.sql 的文本文件

[root@localhost undrop-for-innodb-master]# cd dumps/default/
[root@localhost default]# ll
total 32
-rw-r--r--. 1 root root 470 Jan 19 22:38 SYS_COLUMNS
-rw-r--r--. 1 root root 286 Jan 19 22:38 SYS_COLUMNS.sql
-rw-r--r--. 1 root root 200 Jan 19 22:38 SYS_FIELDS
-rw-r--r--. 1 root root 253 Jan 19 22:38 SYS_FIELDS.sql
-rw-r--r--. 1 root root 317 Jan 19 22:37 SYS_INDEXES
-rw-r--r--. 1 root root 291 Jan 19 22:37 SYS_INDEXES.sql
-rw-r--r--. 1 root root 580 Jan 19 22:34 SYS_TABLES
-rw-r--r--. 1 root root 300 Jan 19 22:34 SYS_TABLES.sql

[root@localhost default]# cat SYS_TABLES.sql
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/undrop-for-innodb-master/dumps/default/SYS_TABLES' REPLACE INTO TABLE `SYS_TABLES` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'SYS_TABLES\t' (`NAME`, `ID`, `N_COLS`, `TYPE`, `MIX_ID`, `MIX_LEN`, `CLUSTER_NAME`, `SPACE`);
[root@localhost default]# cat SYS_TABLES
-- Page id: 8, Format: REDUNDANT, Records list: Invalid, Expected records: (0 28)
000000000511    2D000001360182  SYS_TABLES      "test/t"        36      1       33      0       80      ""      22
000000000B10    2E0000013404D8  SYS_TABLES      "test/articles" 52      3       33      0       80      ""      33
-- Page id: 8, Found records: 2, Lost records: YES, Leaf page: YES
-- Page id: 8, Format: REDUNDANT, Records list: Invalid, Expected records: (0 28)
000000000511    2D000001360182  SYS_TABLES      "test/t"        36      1       33      0       80      ""      22
000000000B10    2E0000013404D8  SYS_TABLES      "test/articles" 52      3       33      0       80      ""      33
-- Page id: 8, Found records: 2, Lost records: YES, Leaf page: YES
[root@localhost default]# cat SYS_FIELDS.sql
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/undrop-for-innodb-master/dumps/default/SYS_FIELDS' REPLACE INTO TABLE `SYS_FIELDS` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'SYS_FIELDS\t' (`INDEX_ID`, `POS`, `COL_NAME`);
[root@localhost default]# cat SYS_FIELDS
-- Page id: 12, Format: REDUNDANT, Records list: Invalid, Expected records: (0 43)
000000000B10    2E0000013403C7  SYS_FIELDS      48      0       "id"
-- Page id: 12, Found records: 1, Lost records: YES, Leaf page: YES
[root@localhost default]# cat SYS_COLUMNS.sql
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/undrop-for-innodb-master/dumps/default/SYS_COLUMNS' REPLACE INTO TABLE `SYS_COLUMNS` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'SYS_COLUMNS\t' (`TABLE_ID`, `POS`, `NAME`, `MTYPE`, `PRTYPE`, `LEN`, `PREC`);
[root@localhost default]# cat SYS_COLUMNS
-- Page id: 10, Format: REDUNDANT, Records list: Invalid, Expected records: (0 133)
000000000582    5A0000016001BA  SYS_COLUMNS     48      0       "i"     6       1027    4       0
000000000585    5C0000016201BA  SYS_COLUMNS     49      0       "i"     6       1027    4       0
000000000B10    2E000001340439  SYS_COLUMNS     52      0       "id"    6       1283    4       0
000000000B10    2E00000134046E  SYS_COLUMNS     52      1       "title" 12      2953231 800     0
000000000B10    2E0000013404A3  SYS_COLUMNS     52      2       "body"  5       2949372 10      0
-- Page id: 10, Found records: 5, Lost records: YES, Leaf page: YES
[root@localhost default]# cat SYS_INDEXES.sql
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/undrop-for-innodb-master/dumps/default/SYS_INDEXES' REPLACE INTO TABLE `SYS_INDEXES` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'SYS_INDEXES\t' (`TABLE_ID`, `ID`, `NAME`, `N_FIELDS`, `TYPE`, `SPACE`, `PAGE_NO`);
[root@localhost default]# cat SYS_INDEXES
-- Page id: 11, Format: REDUNDANT, Records list: Invalid, Expected records: (0 33)
000000000582    5A0000016001EF  SYS_INDEXES     48      46      "GEN\_CLUST\_INDEX"     0       1       4294967295      4294967295
000000000B10    2E0000013403FC  SYS_INDEXES     52      48      "PRIMARY"       1       3       33      4294967295
-- Page id: 11, Found records: 2, Lost records: YES, Leaf page: YES

7:导入新的数据字典信息
注意这里需要是另外一个mysql 实例,因为为了避免数据文件被复写,我们此前已经将事故实例停止了服务。
1:创建数据字典表,该语句来自工具中的dictionary 目录

[root@localhost undrop-for-innodb-master]# cd dictionary/
[root@localhost dictionary]# ll
total 16
-rw-r--r--. 1 root root 1845 Oct  2  2015 SYS_COLUMNS.sql
-rw-r--r--. 1 root root 1685 Oct  2  2015 SYS_FIELDS.sql
-rw-r--r--. 1 root root 1876 Oct  2  2015 SYS_INDEXES.sql
-rw-r--r--. 1 root root 1895 Oct  2  2015 SYS_TABLES.sql

[root@localhost dictionary]# mysql -h10.13.13.25 -P3306 -uroot -pxxzx7817600
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.26-log Source distribution

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+------------------------+
| Database               |
+------------------------+
| information_schema     |
| employees              |
| mysql                  |
| #mysql50#mysql-keyring |
| performance_schema     |
| sys                    |
| test                   |
| undo                   |
+------------------------+
8 rows in set (0.01 sec)

mysql> create database dbrecover;
Query OK, 1 row affected (0.01 sec)

mysql> use dbrecover
Database changed

mysql> source /undrop-for-innodb-master/dictionary/SYS_TABLES.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

mysql> source /undrop-for-innodb-master/dictionary/SYS_INDEXES.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

mysql> source /undrop-for-innodb-master/dictionary/SYS_FIELDS.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

mysql> source /undrop-for-innodb-master/dictionary/SYS_COLUMNS.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.01 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)


[root@localhost mysql]# mysqlshow -h10.13.13.25 -P3306 -uroot -pxxzx7817600 -vv dbrecover
mysqlshow: [Warning] Using a password on the command line interface can be insecure.
Database: dbrecover
+-------------+----------+------------+
|   Tables    | Columns  | Total Rows |
+-------------+----------+------------+
| sys_columns |        7 |          0 |
| sys_fields  |        3 |          0 |
| sys_indexes |        7 |          0 |
| sys_tables  |        8 |          0 |
+-------------+----------+------------+
4 rows in set.

2:导入前面dumps/default 目录生成的LOAD DATA 语句,用于恢复数据字典记录

mysql> source /undrop-for-innodb-master/dumps/default/SYS_TABLES.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 4 rows affected (0.04 sec)
Records: 4  Deleted: 0  Skipped: 0  Warnings: 0

mysql> source /undrop-for-innodb-master/dumps/default/SYS_COLUMNS.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 5 rows affected (0.01 sec)
Records: 5  Deleted: 0  Skipped: 0  Warnings: 0

mysql> source /undrop-for-innodb-master/dumps/default/SYS_INDEXES.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 2 rows affected (0.01 sec)
Records: 2  Deleted: 0  Skipped: 0  Warnings: 0

mysql> source /undrop-for-innodb-master/dumps/default/SYS_FIELDS.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 1 row affected (0.01 sec)
Records: 1  Deleted: 0  Skipped: 0  Warnings: 0

8:解析数据字典获取DDL 语句

[root@localhost undrop-for-innodb-master]# ./sys_parser -h10.13.13.25 -P3306 -uroot -pxxzx7817600 -d dbrcover test/articles
./sys_parser: error while loading shared libraries: libmysqlclient.so.20: cannot open shared object file: No such file or directory

[root@localhost lib]# ln -s /mysqlsoft/mysql/lib/libmysqlclient.so.20 /usr/lib64/libmysqlclient.so.20

[root@localhost undrop-for-innodb-master]# ./sys_parser -h10.13.13.25 -P3306 -uroot -pxxzx7817600 -d dbrecover test/articles
./sys_parser: invalid option -- 'P'
sys_parser [-h ] [-u ] [-p ] [-d ] databases/table
请注意:只能是3306 端口
[root@localhost undrop-for-innodb-master]# ./sys_parser -h10.13.13.25  -uroot -pxxzx7817600 -d dbrecover test/articles
CREATE TABLE `articles`(
        `id` INT NOT NULL,
        `title` VARCHAR(200) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci',
        `body` TEXT,
        PRIMARY KEY (`id`)
) ENGINE=InnoDB;

9:查找drop 表数据对应的page 页
Mysql 是聚簇表,数据都在主键索引上,因此需要确认该primary key 对应的数据页。也有可能没有创建primary ke,数据库会自动隐藏主建。主建primary key 对应的页为56

[root@localhost dictionary]# mysql -h10.13.13.25 -P3306 -uroot -pxxzx7817600
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.26-log Source distribution

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use dbrecover
Database changed

mysql> show tables;
+---------------------+
| Tables_in_dbrecover |
+---------------------+
| sys_columns         |
| sys_fields          |
| sys_indexes         |
| sys_tables          |
+---------------------+
4 rows in set (0.01 sec)

mysql> select * from SYS_TABLES;
+---------------+----+--------+------+--------+---------+--------------+-------+
| NAME          | ID | N_COLS | TYPE | MIX_ID | MIX_LEN | CLUSTER_NAME | SPACE |
+---------------+----+--------+------+--------+---------+--------------+-------+
| test/articles | 52 |      3 |   33 |      0 |      80 |              |    33 |
| test/t        | 36 |      1 |   33 |      0 |      80 |              |    22 |
+---------------+----+--------+------+--------+---------+--------------+-------+
2 rows in set (0.00 sec)

mysql> select * from SYS_INDEXES WHERE TABLE_ID=52;
+----------+----+---------+----------+------+-------+------------+
| TABLE_ID | ID | NAME    | N_FIELDS | TYPE | SPACE | PAGE_NO    |
+----------+----+---------+----------+------+-------+------------+
|       52 | 48 | PRIMARY |        1 |    3 |    33 | 4294967295 |
+----------+----+---------+----------+------+-------+------------+
1 row in set (0.00 sec)

10:解析磁盘页中删除表的记录
注意: 此处几个文件名程序把导出的两个数据文件的文件名关系是写死的, 以下dumps/default/articles 中的articles 是需要和表名一致,在articles_load.sql 中会引用此文件路经./tmp/articles.sql:恢复的表结构的语句

[root@localhost undrop-for-innodb-master]# vi /tmp/articles.sql
CREATE TABLE `articles`(
        `id` INT NOT NULL,
        `title` VARCHAR(200) CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_general_ci',
        `body` TEXT,
        PRIMARY KEY (`id`)
) ENGINE=InnoDB;


[root@localhost undrop-for-innodb-master]# ./c_parser -6f /undrop-for-innodb-master/pages-ol-root/FIL_PAGE_INDEX/0000000000000048.page -t /tmp/articles.sql>./dumps/default/articles 2>./dumps/default/articles_load.sql;
[root@localhost undrop-for-innodb-master]# ll dumps/default/
total 40
-rw-r--r--. 1 root root 437 Jan 20 00:16 articles
-rw-r--r--. 1 root root 239 Jan 20 00:16 articles_load.sql
-rw-r--r--. 1 root root 470 Jan 19 22:38 SYS_COLUMNS
-rw-r--r--. 1 root root 286 Jan 19 22:38 SYS_COLUMNS.sql
-rw-r--r--. 1 root root 200 Jan 19 22:38 SYS_FIELDS
-rw-r--r--. 1 root root 253 Jan 19 22:38 SYS_FIELDS.sql
-rw-r--r--. 1 root root 317 Jan 19 22:37 SYS_INDEXES
-rw-r--r--. 1 root root 291 Jan 19 22:37 SYS_INDEXES.sql
-rw-r--r--. 1 root root 580 Jan 19 22:34 SYS_TABLES
-rw-r--r--. 1 root root 300 Jan 19 22:34 SYS_TABLES.sql
[root@localhost undrop-for-innodb-master]# more ./dumps/default/articles
-- Page id: 3, Format: COMPACT, Records list: Valid, Expected records: (3 3)
000000000B0B    AB0000011E0110  articles        1       "1001 MySQL Tricks"     "1. Never run mysqld as root. 2. ... "
000000000B0B    AB0000011E011C  articles        2       "MySQL vs. YourSQL"     "In the following database comparison ..."
000000000B0B    AB0000011E0128  articles        3       "MySQL Security"        "When configured properly, MySQL ..."
-- Page id: 3, Found records: 3, Lost records: NO, Leaf page: YES
[root@localhost undrop-for-innodb-master]# more ./dumps/default/articles_load.sql
SET FOREIGN_KEY_CHECKS=0;
LOAD DATA LOCAL INFILE '/undrop-for-innodb-master/dumps/default/articles' REPLACE INTO TABLE `articles` FIELDS TERMINATED BY '\t' OPTIONALLY ENCLOSED BY '"' LINES STARTING BY 'articles\t' (`id`, `title`, `body`);

11:恢复表结构并导入数据

mysql> source /tmp/articles.sql
Query OK, 0 rows affected (0.01 sec)

mysql> source /undrop-for-innodb-master/dumps/default/articles_load.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 3 rows affected (0.01 sec)
Records: 3  Deleted: 0  Skipped: 0  Warnings: 0

mysql> select * from articles;
+----+-------------------+------------------------------------------+
| id | title             | body                                     |
+----+-------------------+------------------------------------------+
|  1 | 1001 MySQL Tricks | 1. Never run mysqld as root. 2. ...      |
|  2 | MySQL vs. YourSQL | In the following database comparison ... |
|  3 | MySQL Security    | When configured properly, MySQL ...      |
+----+-------------------+------------------------------------------+
3 rows in set (0.00 sec)

至此数据恢复了。

MySQL InnoDB监视器

InnoDB监视器
InnoDB监视器提供有关InnoDB内部状态的信息。此信息对性能调优很有用。

InnoDB监视器类型
InnoDB监视器有两种类型:
.标准的InnoDB Monitor显示以下类型的信息:
.主后台线程完成的工作
.线程的信号量等待
.关于最近的外键和死锁错误的数据
.锁等待事务
.由活动事务持有的表和记录锁
.待处理I/O操作及相关统计
.插入缓冲区和自适应哈希索引统计信息
.重做日志数据
.缓冲池统计信息
.行运算数据

.InnoDB锁监视器打印额外的锁信息作为标准InnoDB监视器输出的一部分。

启用InnoDB监视器
当InnoDB监控器为周期性输出启用时,InnoDB将输出写入mysqld服务器标准错误输出(stderr)。InnoDB将诊断输出发送到stderr,而不是stdout或固定大小的内存缓冲区,以避免潜在的缓冲区溢出。

在Windows上,stderr被定向到默认日志文件,除非另有配置。如果您希望将输出定向到控制台窗口而不是错误日志,请使用–console选项从控制台窗口的命令提示符启动服务器。

在Unix和类Unix系统上,stderr通常被定向到终端,除非另有配置。

当启用时,InnoDB监控大约每15秒打印一次数据。这些数据在性能调优中很有用。作为副作用,SHOW ENGINE INNODB STATUS的输出每15秒写入MySQL数据目录中的状态文件。文件名为innodb_status.pid,其中pid是服务器进程ID。InnoDB在服务器正常关闭时删除文件。如果发生了异常关机,则可能存在这些状态文件的实例,必须手动删除。在删除文件之前,检查它们是否包含有关异常关机原因的有用信息。一个innodb_status.pid只有启用了innodb-status-file配置选项,才会创建。默认关闭。

InnoDB监控器应该只在你真正想要查看监控器信息时才启用,因为输出的生成会导致一些性能下降。此外,如果监视器输出指向错误日志,如果您稍后忘记禁用监视器,则日志可能会变得相当大。

注意:
为了辅助故障诊断,在某些条件下,InnoDB临时启用了标准的InnoDB监视器输出。

InnoDB监视器输出以一个包含时间戳和监视器名称的报头开始。例如:

=====================================
2024-01-15 16:50:33 0x7f3e8c201700 INNODB MONITOR OUTPUT
=====================================

标准InnoDB监控器的首部(InnoDB监控器输出)也用于锁监控器,因为后者产生了相同的输出,但添加了额外的锁信息。

innodb_status_output和innodb_status_output_locks系统变量用于启用标准的InnoDB监视器和InnoDB锁监视器。

启用或禁用InnoDB监视器需要PROCESS特权。

启用标准InnoDB监视器
通过将innodb_status_output系统变量设置为ON来启用标准InnoDB监视器。

mysql> SET GLOBAL innodb_status_output=ON;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like '%innodb_status_output%';
+----------------------------+-------+
| Variable_name              | Value |
+----------------------------+-------+
| innodb_status_output       | ON    |
| innodb_status_output_locks | OFF   |
+----------------------------+-------+
2 rows in set (0.01 sec)

关闭标准的InnoDB Monitor,将innodb_status_output设置为OFF。

当您关闭服务器时,innodb_status_output变量被设置为默认的OFF值。

按需获取标准的InnoDB监控器输出
作为启用标准InnoDB监控器周期性输出的替代方案,您可以使用SHOW ENGINE INNODB STATUS SQL语句按需获取标准InnoDB监控器输出,该语句将输出获取到您的客户端程序。如果你使用的是mysql交互式客户端,将通常的分号语句结束符替换为\G,输出的可读性会更好:

mysql> SHOW ENGINE INNODB STATUS\G
*************************** 1. row ***************************
  Type: InnoDB
  Name:
Status:
=====================================
2024-01-15 16:50:33 0x7f3e8c201700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 8 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 27 srv_active, 0 srv_shutdown, 427925 srv_idle
srv_master_thread log flush and writes: 427940
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 15736
OS WAIT ARRAY INFO: signal count 1770
RW-shared spins 0, rounds 18523, OS waits 12422
RW-excl spins 0, rounds 32549, OS waits 1086
RW-sx spins 1768, rounds 50702, OS waits 1607
Spin rounds per wait: 18523.00 RW-shared, 32549.00 RW-excl, 28.68 RW-sx
------------
TRANSACTIONS
------------
Trx id counter 5697073
Purge done for trx's n:o < 5697071 undo n:o < 0 state: running but idle
History list length 70
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421390708152144, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
--------
FILE I/O
--------
I/O thread 0 state: waiting for i/o request (insert buffer thread)
I/O thread 1 state: waiting for i/o request (log thread)
I/O thread 2 state: waiting for i/o request (read thread)
I/O thread 3 state: waiting for i/o request (read thread)
I/O thread 4 state: waiting for i/o request (read thread)
I/O thread 5 state: waiting for i/o request (read thread)
I/O thread 6 state: waiting for i/o request (write thread)
I/O thread 7 state: waiting for i/o request (write thread)
I/O thread 8 state: waiting for i/o request (write thread)
I/O thread 9 state: waiting for i/o request (write thread)
Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,
 ibuf aio reads:, log i/o's:, sync i/o's:
Pending flushes (fsync) log: 0; buffer pool: 0
141 OS file reads, 4062 OS file writes, 3289 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 1714, seg size 1716, 0 merges
merged operations:
 insert 0, delete mark 0, delete 0
discarded operations:
 insert 0, delete mark 0, delete 0
Hash table size 2365241, node heap has 0 buffer(s)
Hash table size 2365241, node heap has 0 buffer(s)
Hash table size 2365241, node heap has 0 buffer(s)
Hash table size 2365241, node heap has 0 buffer(s)
Hash table size 2365241, node heap has 0 buffer(s)
Hash table size 2365241, node heap has 0 buffer(s)
Hash table size 2365241, node heap has 0 buffer(s)
Hash table size 2365241, node heap has 0 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
---
LOG
---
Log sequence number 89430260246
Log flushed up to   89430260246
Pages flushed up to 89430260246
Last checkpoint at  89430260237
0 pending log flushes, 0 pending chkp writes
2662 log i/o's done, 0.00 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 8795455488
Dictionary memory allocated 234968
Buffer pool size   524224
Free buffers       523545
Database pages     685
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 96, created 589, written 893
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 685, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
----------------------
INDIVIDUAL BUFFER POOL INFO
----------------------
---BUFFER POOL 0
Buffer pool size   65528
Free buffers       65456
Database pages     78
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 31, created 47, written 131
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 78, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 1
Buffer pool size   65528
Free buffers       65391
Database pages     137
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 11, created 126, written 367
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 137, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 2
Buffer pool size   65528
Free buffers       65413
Database pages     115
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 8, created 107, written 166
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 115, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 3
Buffer pool size   65528
Free buffers       65406
Database pages     122
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 13, created 109, written 182
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 122, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 4
Buffer pool size   65528
Free buffers       65463
Database pages     65
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 8, created 57, written 16
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 65, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 5
Buffer pool size   65528
Free buffers       65469
Database pages     59
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 9, created 50, written 11
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 59, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 6
Buffer pool size   65528
Free buffers       65470
Database pages     58
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 9, created 49, written 10
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 58, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 7
Buffer pool size   65528
Free buffers       65477
Database pages     51
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 7, created 44, written 10
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 51, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
0 read views open inside InnoDB
Process ID=10759, Main thread ID=139906706892544, state: sleeping
Number of rows inserted 5990, updated 0, deleted 0, read 1794460
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================

1 row in set (0.00 sec)

如果启用了InnoDB锁监视器, SHOW ENGINE INNODB STATUS输出还包括InnoDB锁监视器数据。

启用InnoDB锁监视器
InnoDB锁监控器数据与InnoDB标准监控器输出一起打印。InnoDB标准监控器和InnoDB锁监控器都必须启用,才能定期打印InnoDB锁监控器数据。

开启InnoDB锁监控,设置innodb_status_output_locks系统变量为ON。InnoDB标准监控器和InnoDB锁监控器都必须启用,以便定期打印InnoDB锁监控器数据:

mysql> SET GLOBAL innodb_status_output=ON;
Query OK, 0 rows affected (0.00 sec)

mysql> SET GLOBAL innodb_status_output_locks=ON;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like '%innodb_status_output%';
+----------------------------+-------+
| Variable_name              | Value |
+----------------------------+-------+
| innodb_status_output       | ON    |
| innodb_status_output_locks | ON    |
+----------------------------+-------+
2 rows in set (0.00 sec)

要禁用InnoDB锁监控,将innodb_status_output_locks设置为OFF。将innodb_status_output设置为OFF也禁用InnoDB标准监视器。

当你关闭服务器时,innodb_status_output和innodb_status_output_locks变量被设置为默认的OFF值。

注意:
为SHOW ENGINE INNODB STATUS输出启用InnoDB锁监视器,只需要启用innodb_status_output_locks。

InnoDB标准监视器和锁监视器输出
锁监视器与标准监视器相同,只是它包含了额外的锁信息。

为周期性输出启用任一监视器都会打开相同的输出流,但如果启用了Lock monitor,则该流将包含额外的信息。例如,如果您启用了标准监控和锁定监视器,它打开单个输出流。在禁用锁监视器之前,流包含额外的锁信息。

当使用SHOW ENGINE INNODB STATUS语句生成时,标准Monitor输出限制为1MB。此限制不适用于写入tserver标准错误输出(stderr)的输出。

标准监视器输出示例:

mysql> SHOW ENGINE INNODB STATUS\G
*************************** 1. row ***************************
  Type: InnoDB
  Name:
Status:
=====================================
2024-01-15 17:08:03 0x7f3e8c201700 INNODB MONITOR OUTPUT
=====================================
Per second averages calculated from the last 18 seconds
-----------------
BACKGROUND THREAD
-----------------
srv_master_thread loops: 27 srv_active, 0 srv_shutdown, 428975 srv_idle
srv_master_thread log flush and writes: 428990
----------
SEMAPHORES
----------
OS WAIT ARRAY INFO: reservation count 15736
OS WAIT ARRAY INFO: signal count 1770
RW-shared spins 0, rounds 18523, OS waits 12422
RW-excl spins 0, rounds 32549, OS waits 1086
RW-sx spins 1768, rounds 50702, OS waits 1607
Spin rounds per wait: 18523.00 RW-shared, 32549.00 RW-excl, 28.68 RW-sx
------------
TRANSACTIONS
------------
Trx id counter 5697073
Purge done for trx's n:o < 5697071 undo n:o < 0 state: running but idle
History list length 70
LIST OF TRANSACTIONS FOR EACH SESSION:
---TRANSACTION 421390708152144, not started
0 lock struct(s), heap size 1136, 0 row lock(s)
--------
FILE I/O
--------
I/O thread 0 state: waiting for i/o request (insert buffer thread)
I/O thread 1 state: waiting for i/o request (log thread)
I/O thread 2 state: waiting for i/o request (read thread)
I/O thread 3 state: waiting for i/o request (read thread)
I/O thread 4 state: waiting for i/o request (read thread)
I/O thread 5 state: waiting for i/o request (read thread)
I/O thread 6 state: waiting for i/o request (write thread)
I/O thread 7 state: waiting for i/o request (write thread)
I/O thread 8 state: waiting for i/o request (write thread)
I/O thread 9 state: waiting for i/o request (write thread)
Pending normal aio reads: [0, 0, 0, 0] , aio writes: [0, 0, 0, 0] ,
 ibuf aio reads:, log i/o's:, sync i/o's:
Pending flushes (fsync) log: 0; buffer pool: 0
141 OS file reads, 4062 OS file writes, 3289 OS fsyncs
0.00 reads/s, 0 avg bytes/read, 0.00 writes/s, 0.00 fsyncs/s
-------------------------------------
INSERT BUFFER AND ADAPTIVE HASH INDEX
-------------------------------------
Ibuf: size 1, free list len 1714, seg size 1716, 0 merges
merged operations:
 insert 0, delete mark 0, delete 0
discarded operations:
 insert 0, delete mark 0, delete 0
Hash table size 2365241, node heap has 0 buffer(s)
Hash table size 2365241, node heap has 0 buffer(s)
Hash table size 2365241, node heap has 0 buffer(s)
Hash table size 2365241, node heap has 0 buffer(s)
Hash table size 2365241, node heap has 0 buffer(s)
Hash table size 2365241, node heap has 0 buffer(s)
Hash table size 2365241, node heap has 0 buffer(s)
Hash table size 2365241, node heap has 0 buffer(s)
0.00 hash searches/s, 0.00 non-hash searches/s
---
LOG
---
Log sequence number 89430260246
Log flushed up to   89430260246
Pages flushed up to 89430260246
Last checkpoint at  89430260237
0 pending log flushes, 0 pending chkp writes
2662 log i/o's done, 0.00 log i/o's/second
----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 8795455488
Dictionary memory allocated 234968
Buffer pool size   524224
Free buffers       523545
Database pages     685
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 96, created 589, written 893
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 685, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
----------------------
INDIVIDUAL BUFFER POOL INFO
----------------------
---BUFFER POOL 0
Buffer pool size   65528
Free buffers       65456
Database pages     78
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 31, created 47, written 131
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 78, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 1
Buffer pool size   65528
Free buffers       65391
Database pages     137
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 11, created 126, written 367
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 137, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 2
Buffer pool size   65528
Free buffers       65413
Database pages     115
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 8, created 107, written 166
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 115, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 3
Buffer pool size   65528
Free buffers       65406
Database pages     122
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 13, created 109, written 182
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 122, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 4
Buffer pool size   65528
Free buffers       65463
Database pages     65
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 8, created 57, written 16
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 65, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 5
Buffer pool size   65528
Free buffers       65469
Database pages     59
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 9, created 50, written 11
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 59, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 6
Buffer pool size   65528
Free buffers       65470
Database pages     58
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 9, created 49, written 10
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 58, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 7
Buffer pool size   65528
Free buffers       65477
Database pages     51
Old database pages 0
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 0, not young 0
0.00 youngs/s, 0.00 non-youngs/s
Pages read 7, created 44, written 10
0.00 reads/s, 0.00 creates/s, 0.00 writes/s
No buffer pool page gets since the last printout
Pages read ahead 0.00/s, evicted without access 0.00/s, Random read ahead 0.00/s
LRU len: 51, unzip_LRU len: 0
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
--------------
ROW OPERATIONS
--------------
0 queries inside InnoDB, 0 queries in queue
0 read views open inside InnoDB
Process ID=10759, Main thread ID=139906706892544, state: sleeping
Number of rows inserted 5990, updated 0, deleted 0, read 1794460
0.00 inserts/s, 0.00 updates/s, 0.00 deletes/s, 0.00 reads/s
----------------------------
END OF INNODB MONITOR OUTPUT
============================

1 row in set (0.00 sec)

标准监视器输出部分
.Status(状态)
本节显示时间戳、监视器名称和每秒平均值所基于的秒数。秒数是当前时间和最后一次打印InnoDB Monitor输出之间经过的时间。

.BACKGROUND THREAD(后台线程)
srv_master_thread行显示了主后台线程完成的工作。

.SEMAPHORES(信号量)
这部分是报告等待信号量的线程,以及线程需要旋转或等待互斥量或rw-lock信号量的统计数据。大量线程等待信号量可能是磁盘I/O的结果,或者是InnoDB内部的争用问题。竞争可能是由于大量的并行查询或操作系统线程调度问题造成的。在这种情况下,将innodb_thread_concurrency系统变量设置为小于默认值可能会有所帮助。Spin rounds per wait line显示了每个操作系统等待互斥量的旋转轮数。

互斥参数由SHOW ENGINE INNODB MUTEX报告。

mysql> SHOW ENGINE INNODB MUTEX\G
*************************** 1. row ***************************
  Type: InnoDB
  Name: rwlock: dict0dict.cc:2737
Status: waits=35
*************************** 2. row ***************************
  Type: InnoDB
  Name: rwlock: dict0dict.cc:1183
Status: waits=77
*************************** 3. row ***************************
  Type: InnoDB
  Name: rwlock: log0log.cc:838
Status: waits=32
*************************** 4. row ***************************
  Type: InnoDB
  Name: sum rwlock: buf0buf.cc:1460
Status: waits=13399
4 rows in set (0.04 sec)

.LATEST FOREIGN KEY ERROR(最新的外键错误)
本节提供有关最近的外键约束错误的信息。如果没有发生此类错误,则不存在该错误。内容包括失败的语句以及有关失败的约束以及被引用表和引用表的信息。

.LATEST DETECTED DEADLOCK(最近检测到的死锁)
本节提供有关最近死锁的信息。如果没有发生死锁,则不存在。内容显示了涉及到哪些事务,每个试图执行的语句,它们拥有和需要的锁,以及InnoDB决定回滚哪个事务以打破死锁。

.TRANSACTIONS(事务)
如果本节报告锁等待,则您的应用程序可能存在锁争用。输出还可以帮助跟踪事务死锁的原因。

.FILE I/O(文件IO)
本节提供了InnoDB用于执行各种类型I/O的线程的信息。前几个是专用于一般InnoDB处理的。内容还显示挂起的I/O操作信息和I/O性能统计信息。

这些线程的数量由innodb_read_io_threads和innodb_write_io_threads参数控制。

.INSERT BUFFER AND ADAPTIVE HASH INDEX
本节展示了InnoDB插入缓冲区(也称为更改缓冲区)和自适应哈希索引的状态。

.LOG
介绍InnoDB日志的相关信息。内容包括当前日志序列号,日志被刷新到磁盘的距离,以及InnoDB最后一次执行检查点的位置。该部分还显示有关挂起写和写性能统计信息的信息。

.BUFFER POOL AND MEMORY
本节提供了读取和写入页面的统计信息。您可以从这些数字中计算出查询当前正在执行多少数据文件I/O操作

.ROW OPERATIONS
本节显示主线程正在执行的操作,包括每种类型的行操作的数量和性能比率。

MySQL InnoDB集成MySQL性能模式

InnoDB集成MySQL性能模式

你可以使用MySQL Performance Schema特性来分析某些内部InnoDB操作。这种类型的调优主要针对那些评估优化策略以克服性能瓶颈的专家用户。dba还可以使用此功能进行容量规划,以查看他们的典型工作负载在特定的CPU、RAM和磁盘存储组合上是否遇到任何性能瓶颈;如果是,则判断是否可以通过增加系统某些部分的容量来提高性能。

使用这个特性来检查InnoDB的性能:
.您必须熟悉如何使用Performance Schema特性。例如,您应该知道如何启用仪器和消费者,以及如何查询performance_schema表以检索数据。

.您应该熟悉用于InnoDB的性能模式工具。要查看与innodb相关的仪器,可以查询setup_instruments表中包含’innodb’的仪器名称。

mysql> use performance_schema
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
mysql> SELECT * FROM setup_instruments WHERE NAME LIKE '%innodb%';
+-------------------------------------------------------+---------+-------+
| NAME                                                  | ENABLED | TIMED |
+-------------------------------------------------------+---------+-------+
| wait/synch/mutex/innodb/commit_cond_mutex             | NO      | NO    |
| wait/synch/mutex/innodb/innobase_share_mutex          | NO      | NO    |
| wait/synch/mutex/innodb/autoinc_mutex                 | NO      | NO    |
..........
| memory/innodb/adaptive hash index                     | NO      | NO    |
| memory/innodb/buf_buf_pool                            | NO      | NO    |
| memory/innodb/dict_stats_bg_recalc_pool_t             | NO      | NO    |
| memory/innodb/dict_stats_index_map_t                  | NO      | NO    |
| memory/innodb/dict_stats_n_diff_on_level              | NO      | NO    |
| memory/innodb/other                                   | NO      | NO    |
| memory/innodb/row_log_buf                             | NO      | NO    |
| memory/innodb/row_merge_sort                          | NO      | NO    |
| memory/innodb/std                                     | NO      | NO    |
| memory/innodb/trx_sys_t::rw_trx_ids                   | NO      | NO    |
| memory/innodb/partitioning                            | NO      | NO    |
| memory/innodb/api0api                                 | NO      | NO    |
| memory/innodb/btr0btr                                 | NO      | NO    |
| memory/innodb/btr0bulk                                | NO      | NO    |
| memory/innodb/btr0cur                                 | NO      | NO    |
| memory/innodb/btr0pcur                                | NO      | NO    |
| memory/innodb/btr0sea                                 | NO      | NO    |
| memory/innodb/buf0buf                                 | NO      | NO    |
| memory/innodb/buf0dblwr                               | NO      | NO    |
| memory/innodb/buf0dump                                | NO      | NO    |
| memory/innodb/buf0flu                                 | NO      | NO    |
| memory/innodb/buf0lru                                 | NO      | NO    |
| memory/innodb/dict0dict                               | NO      | NO    |
| memory/innodb/dict0mem                                | NO      | NO    |
| memory/innodb/dict0stats                              | NO      | NO    |
| memory/innodb/dict0stats_bg                           | NO      | NO    |
| memory/innodb/eval0eval                               | NO      | NO    |
| memory/innodb/fil0fil                                 | NO      | NO    |
| memory/innodb/fsp0file                                | NO      | NO    |
| memory/innodb/fsp0space                               | NO      | NO    |
| memory/innodb/fsp0sysspace                            | NO      | NO    |
| memory/innodb/fts0ast                                 | NO      | NO    |
| memory/innodb/fts0config                              | NO      | NO    |
| memory/innodb/fts0fts                                 | NO      | NO    |
| memory/innodb/fts0opt                                 | NO      | NO    |
| memory/innodb/fts0pars                                | NO      | NO    |
| memory/innodb/fts0que                                 | NO      | NO    |
| memory/innodb/fts0sql                                 | NO      | NO    |
| memory/innodb/gis0sea                                 | NO      | NO    |
| memory/innodb/ha0ha                                   | NO      | NO    |
| memory/innodb/ha_innodb                               | NO      | NO    |
| memory/innodb/handler0alter                           | NO      | NO    |
| memory/innodb/hash0hash                               | NO      | NO    |
| memory/innodb/i_s                                     | NO      | NO    |
| memory/innodb/ibuf0ibuf                               | NO      | NO    |
| memory/innodb/lexyy                                   | NO      | NO    |
| memory/innodb/lock0lock                               | NO      | NO    |
| memory/innodb/log0log                                 | NO      | NO    |
| memory/innodb/log0recv                                | NO      | NO    |
| memory/innodb/mem0mem                                 | NO      | NO    |
| memory/innodb/os0event                                | NO      | NO    |
| memory/innodb/os0file                                 | NO      | NO    |
| memory/innodb/page0cur                                | NO      | NO    |
| memory/innodb/page0zip                                | NO      | NO    |
| memory/innodb/pars0lex                                | NO      | NO    |
| memory/innodb/read0read                               | NO      | NO    |
| memory/innodb/rem0rec                                 | NO      | NO    |
| memory/innodb/row0ftsort                              | NO      | NO    |
| memory/innodb/row0import                              | NO      | NO    |
| memory/innodb/row0log                                 | NO      | NO    |
| memory/innodb/row0merge                               | NO      | NO    |
| memory/innodb/row0mysql                               | NO      | NO    |
| memory/innodb/row0sel                                 | NO      | NO    |
| memory/innodb/row0trunc                               | NO      | NO    |
| memory/innodb/srv0conc                                | NO      | NO    |
| memory/innodb/srv0srv                                 | NO      | NO    |
| memory/innodb/srv0start                               | NO      | NO    |
| memory/innodb/sync0arr                                | NO      | NO    |
| memory/innodb/sync0debug                              | NO      | NO    |
| memory/innodb/sync0rw                                 | NO      | NO    |
| memory/innodb/sync0types                              | NO      | NO    |
| memory/innodb/trx0i_s                                 | NO      | NO    |
| memory/innodb/trx0purge                               | NO      | NO    |
| memory/innodb/trx0roll                                | NO      | NO    |
| memory/innodb/trx0rseg                                | NO      | NO    |
| memory/innodb/trx0sys                                 | NO      | NO    |
| memory/innodb/trx0trx                                 | NO      | NO    |
| memory/innodb/trx0undo                                | NO      | NO    |
| memory/innodb/usr0sess                                | NO      | NO    |
| memory/innodb/ut0list                                 | NO      | NO    |
| memory/innodb/ut0mem                                  | NO      | NO    |
| memory/innodb/ut0mutex                                | NO      | NO    |
| memory/innodb/ut0pool                                 | NO      | NO    |
| memory/innodb/ut0rbt                                  | NO      | NO    |
| memory/innodb/ut0wqueue                               | NO      | NO    |
+-------------------------------------------------------+---------+-------+
167 rows in set (0.00 sec)

关于已仪表化的InnoDB对象的附加信息,您可以查询Performance Schema实例表,它提供了关于已仪表化对象的附加信息。与InnoDB相关的实例表
包括:
.mutex_instances表
.rwlock_instances表
.cond_instances表
.file_instances表

注意:
与InnoDB缓冲池相关的互斥量和读写锁不在本章的讨论范围内;SHOW ENGINE INNODB MUTEX命令的输出结果也是如此。

例如,在执行文件I/O仪表化时,要查看Performance Schema所看到的已仪表化的InnoDB文件对象的信息,您可以发出以下查询:

mysql> SELECT * FROM file_instances WHERE EVENT_NAME LIKE '%innodb%'\G
*************************** 1. row ***************************
 FILE_NAME: /mysqldata/mysql/ibdata1
EVENT_NAME: wait/io/file/innodb/innodb_data_file
OPEN_COUNT: 3
*************************** 2. row ***************************
 FILE_NAME: /mysqldata/mysql/ib_logfile0
EVENT_NAME: wait/io/file/innodb/innodb_log_file
OPEN_COUNT: 2
*************************** 3. row ***************************
 FILE_NAME: /mysqldata/mysql/ib_logfile1
EVENT_NAME: wait/io/file/innodb/innodb_log_file
OPEN_COUNT: 2
......

你应该要熟悉存储InnoDB事件数据的performance_schema表。与innodb相关事件相关的表包括:
.等待事件表,存储等待事件。

.汇总表,提供随时间推移终止的事件的聚合信息。汇总表包括文件I/O汇总表,它聚合了关于I/O操作的信息。

.阶段事件表,存储InnoDB ALTER TABLE和缓冲池load操作事件数据。

使用性能模式监控InnoDB表的ALTER TABLE进度

你可以使用Performance Schema监控InnoDB表的ALTER TABLE进度。

有7个阶段事件表示ALTER TABLE的不同阶段。每个阶段事件报告整个ALTER TABLE操作在其不同阶段进行时的WORK_COMPLETED和WORK_ESTIMATED运行总数。WORK_ESTIMATEDe使用一个公式计算,该公式考虑了ALTER TABLE执行的所有工作,并且可能在ALTER TABLE处理期间进行修改。WORK_COMPLETED和WORK_ESTIMATED值是ALTER TABLE执行的所有工作的抽象表示。

按照发生的顺序,ALTER TABLE阶段的事件包括:
.stage/innodb/alter table (read PK and internal sort):当ALTER TABLE处于read -primary-key阶段时,这个阶段是活动的。它一开始将设置WORK_COMPLETED=0和WORK_ESTIMATED设置为主键中估计的页面数。当这个阶段完成时,WORK_ESTIMATED被更新为主键中的实际页面数。

.stage/innodb/alter table (merge sort):对于通过ALTER TABLE操作添加的每个索引,重复此阶段。

.stage/innodb/alter table (insert):对于通过ALTER TABLE操作添加的每个索引,重复此阶段。

.stage/innodb/alter table (log apply index):这个阶段包括应用运行ALTER TABLE时生成的DML日志。

.stage/innodb/alter table (flush):在此阶段开始之前,根据刷新列表的长度,使用更准确的估计值更新WORK_ESTIMATED。

.stage/innodb/alter table (log apply table):此阶段包括应用在ALTER TABLE运行时生成的并发DML日志。这个阶段的持续时间取决于表变化的程度。如果在表上没有运行并发的DML,则此阶段会瞬间完成。

.stage/innodb/alter table (end):包括在刷新阶段之后出现的任何剩余工作,例如当运行ALTER TABLE时重新应用在表上执行的DML。

注意:
InnoDB ALTER TABLE阶段事件目前不会对添加的空间索引进行计数。

使用Performance Schema(性能模式)监控ALTER TABLE操作

下面的例子演示了如何启用stage/innodb/alter table% stage事件仪器和相关的消费者表来监控alter table的进度。
1.启用stage/innodb/alter%仪器:

mysql> UPDATE setup_instruments SET ENABLED = 'YES' WHERE NAME LIKE 'stage/innodb/alter%';
Query OK, 7 rows affected (0.00 sec)
Rows matched: 7  Changed: 7  Warnings: 0

2.启用阶段事件消费者表,其中包括events_stages_current、events_stages_history和events_stages_history_long。

mysql> UPDATE setup_consumers SET ENABLED = 'YES' WHERE NAME LIKE '%stages%';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0

3.执行ALTER TABLE操作。在本例中,将middle_name列添加到employees示例数据库的employees表中。

mysql> ALTER TABLE employees.employees ADD COLUMN middle_name varchar(14) AFTER first_name;
Query OK, 0 rows affected (1.80 sec)
Records: 0  Duplicates: 0  Warnings: 0

4.通过查询Performance Schema的events_stages_current表来检查ALTER TABLE操作的进度。所显示的阶段事件取决于当前正在进行的ALTER TABLE阶段。WORK_COMPLETED列显示完成的工作,WORK_ESTIMATED列提供了对剩余工作的估计。

mysql> use performance_schema
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
mysql> SELECT EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED FROM events_stages_current;
Empty set (0.00 sec)

mysql> SELECT EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED FROM events_stages_current;
+----------------------------------+----------------+----------------+
| EVENT_NAME                       | WORK_COMPLETED | WORK_ESTIMATED |
+----------------------------------+----------------+----------------+
| stage/innodb/alter table (flush) |            938 |           1793 |
+----------------------------------+----------------+----------------+
1 row in set (0.00 sec)

如果ALTER TABLE操作已经完成,events_stages_current表返回一个空集合。在这种情况下,您可以检查events_stages_history表来查看已完成操作的事件数据。例如:

mysql> SELECT EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED FROM events_stages_history;
+------------------------------------------------------+----------------+----------------+
| EVENT_NAME                                           | WORK_COMPLETED | WORK_ESTIMATED |
+------------------------------------------------------+----------------+----------------+
| stage/innodb/alter table (read PK and internal sort) |            886 |           1793 |
| stage/innodb/alter table (flush)                     |           1793 |           1793 |
| stage/innodb/alter table (log apply table)           |           2177 |           2177 |
| stage/innodb/alter table (end)                       |           2177 |           2177 |
| stage/innodb/alter table (log apply table)           |           2561 |           2561 |
+------------------------------------------------------+----------------+----------------+
5 rows in set (0.00 sec)

如上所示,在ALTER TABLE处理期间修改了WORK_ESTIMATED的值。初始阶段完成后的预计工作量为1793。当ALTER TABLE处理完成时,WORK_ESTIMATED被设置为实际值,即2561。

使用Performance Schema(性能模式)监控InnoDB互斥锁等待
互斥锁是代码中使用的一种同步机制,用于强制在给定时间内只有一个线程可以访问公共资源。当服务器上执行的两个或多个线程需要访问相同的资源时,线程之间会相互竞争。第一个获得互斥锁的线程会导致其他线程等待,直到锁被释放。

对于仪表化的InnoDB互斥锁,可以使用Performance Schema来监控互斥锁的等待。
例如,在Performance Schema表中收集的等待事件数据可以帮助识别等待时间最长或总等待时间最长的互斥锁。

下面的例子演示了如何启用InnoDB互斥锁等待工具,如何启用关联的消费者,以及如何查询等待事件数据。
1.要查看可用的InnoDB互斥锁等待工具,请查询Performance Schema setup_instruments表,如下所示。所有InnoDB互斥锁等待工具默认是禁用的。

mysql> SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE '%wait/synch/mutex/innodb%';
+-------------------------------------------------------+---------+-------+
| NAME                                                  | ENABLED | TIMED |
+-------------------------------------------------------+---------+-------+
| wait/synch/mutex/innodb/commit_cond_mutex             | NO      | NO    |
| wait/synch/mutex/innodb/innobase_share_mutex          | NO      | NO    |
| wait/synch/mutex/innodb/autoinc_mutex                 | NO      | NO    |
| wait/synch/mutex/innodb/buf_pool_mutex                | NO      | NO    |
| wait/synch/mutex/innodb/buf_pool_zip_mutex            | NO      | NO    |
| wait/synch/mutex/innodb/cache_last_read_mutex         | NO      | NO    |
| wait/synch/mutex/innodb/dict_foreign_err_mutex        | NO      | NO    |
| wait/synch/mutex/innodb/dict_sys_mutex                | NO      | NO    |
| wait/synch/mutex/innodb/recalc_pool_mutex             | NO      | NO    |
| wait/synch/mutex/innodb/file_format_max_mutex         | NO      | NO    |
| wait/synch/mutex/innodb/fil_system_mutex              | NO      | NO    |
| wait/synch/mutex/innodb/flush_list_mutex              | NO      | NO    |
| wait/synch/mutex/innodb/fts_bg_threads_mutex          | NO      | NO    |
| wait/synch/mutex/innodb/fts_delete_mutex              | NO      | NO    |
| wait/synch/mutex/innodb/fts_optimize_mutex            | NO      | NO    |
| wait/synch/mutex/innodb/fts_doc_id_mutex              | NO      | NO    |
| wait/synch/mutex/innodb/fts_pll_tokenize_mutex        | NO      | NO    |
| wait/synch/mutex/innodb/log_flush_order_mutex         | NO      | NO    |
| wait/synch/mutex/innodb/hash_table_mutex              | NO      | NO    |
| wait/synch/mutex/innodb/ibuf_bitmap_mutex             | NO      | NO    |
| wait/synch/mutex/innodb/ibuf_mutex                    | NO      | NO    |
| wait/synch/mutex/innodb/ibuf_pessimistic_insert_mutex | NO      | NO    |
| wait/synch/mutex/innodb/log_sys_mutex                 | NO      | NO    |
| wait/synch/mutex/innodb/log_sys_write_mutex           | NO      | NO    |
| wait/synch/mutex/innodb/log_cmdq_mutex                | NO      | NO    |
| wait/synch/mutex/innodb/mutex_list_mutex              | NO      | NO    |
| wait/synch/mutex/innodb/page_cleaner_mutex            | NO      | NO    |
| wait/synch/mutex/innodb/page_zip_stat_per_index_mutex | NO      | NO    |
| wait/synch/mutex/innodb/purge_sys_pq_mutex            | NO      | NO    |
| wait/synch/mutex/innodb/recv_sys_mutex                | NO      | NO    |
| wait/synch/mutex/innodb/recv_writer_mutex             | NO      | NO    |
| wait/synch/mutex/innodb/redo_rseg_mutex               | NO      | NO    |
| wait/synch/mutex/innodb/noredo_rseg_mutex             | NO      | NO    |
| wait/synch/mutex/innodb/rw_lock_list_mutex            | NO      | NO    |
| wait/synch/mutex/innodb/rw_lock_mutex                 | NO      | NO    |
| wait/synch/mutex/innodb/srv_dict_tmpfile_mutex        | NO      | NO    |
| wait/synch/mutex/innodb/srv_innodb_monitor_mutex      | NO      | NO    |
| wait/synch/mutex/innodb/srv_misc_tmpfile_mutex        | NO      | NO    |
| wait/synch/mutex/innodb/srv_monitor_file_mutex        | NO      | NO    |
| wait/synch/mutex/innodb/buf_dblwr_mutex               | NO      | NO    |
| wait/synch/mutex/innodb/trx_undo_mutex                | NO      | NO    |
| wait/synch/mutex/innodb/trx_pool_mutex                | NO      | NO    |
| wait/synch/mutex/innodb/trx_pool_manager_mutex        | NO      | NO    |
| wait/synch/mutex/innodb/srv_sys_mutex                 | NO      | NO    |
| wait/synch/mutex/innodb/lock_mutex                    | NO      | NO    |
| wait/synch/mutex/innodb/lock_wait_mutex               | NO      | NO    |
| wait/synch/mutex/innodb/trx_mutex                     | NO      | NO    |
| wait/synch/mutex/innodb/srv_threads_mutex             | NO      | NO    |
| wait/synch/mutex/innodb/rtr_active_mutex              | NO      | NO    |
| wait/synch/mutex/innodb/rtr_match_mutex               | NO      | NO    |
| wait/synch/mutex/innodb/rtr_path_mutex                | NO      | NO    |
| wait/synch/mutex/innodb/rtr_ssn_mutex                 | NO      | NO    |
| wait/synch/mutex/innodb/trx_sys_mutex                 | NO      | NO    |
| wait/synch/mutex/innodb/thread_mutex                  | NO      | NO    |
| wait/synch/mutex/innodb/sync_array_mutex              | NO      | NO    |
| wait/synch/mutex/innodb/zip_pad_mutex                 | NO      | NO    |
| wait/synch/mutex/innodb/row_drop_list_mutex           | NO      | NO    |
| wait/synch/mutex/innodb/master_key_id_mutex           | NO      | NO    |
+-------------------------------------------------------+---------+-------+
58 rows in set (0.00 sec)

2.一些InnoDB互斥锁实例是在服务器启动时创建的,并且只有在服务器启动时启用了相关的工具时才会被检测。为了确保所有InnoDB互斥锁实例都被仪表化和启用,请将以下性能模式仪表规则添加到您的MySQL配置文件:

performance-schema-instrument='wait/synch/mutex/innodb%=ON'

如果您不需要某等待事件的所有InnoDB互斥锁数据,您可以通过在MySQL配置文件中添加额外的性能模式仪表规则来禁用特定的仪表。例如,要禁用与全文搜索相关的InnoDB互斥锁等待事件工具,请添加以下规则:

performance-schema-instrument='wait/synch/mutex/innodb/fts%=OFF'

注意:
前缀较长的规则(如wait/sync /mutex/innodb/fts%)优先于前缀较短的规则(如wait/sync /mutex/innodb/ %)。

将performance-schema-instrument规则添加到配置文件后,重新启动服务器。除了那些与全文搜索相关的其它所有的InnoDB互斥锁都是启用的。要验证这一点,请查询setup_instruments表。对于您启用的仪器,ENABLED和TIMED列应该设置为YES。

[root@localhost mysql]# service mysqld restart
Shutting down MySQL.... SUCCESS!
Starting MySQL... SUCCESS!

mysql> SELECT * FROM performance_schema.setup_instruments WHERE NAME LIKE '%wait/synch/mutex/innodb%';
+-------------------------------------------------------+---------+-------+
| NAME                                                  | ENABLED | TIMED |
+-------------------------------------------------------+---------+-------+
| wait/synch/mutex/innodb/commit_cond_mutex             | YES     | YES   |
| wait/synch/mutex/innodb/innobase_share_mutex          | YES     | YES   |
| wait/synch/mutex/innodb/autoinc_mutex                 | YES     | YES   |
| wait/synch/mutex/innodb/buf_pool_mutex                | YES     | YES   |
| wait/synch/mutex/innodb/buf_pool_zip_mutex            | YES     | YES   |
| wait/synch/mutex/innodb/cache_last_read_mutex         | YES     | YES   |
| wait/synch/mutex/innodb/dict_foreign_err_mutex        | YES     | YES   |
| wait/synch/mutex/innodb/dict_sys_mutex                | YES     | YES   |
| wait/synch/mutex/innodb/recalc_pool_mutex             | YES     | YES   |
| wait/synch/mutex/innodb/file_format_max_mutex         | YES     | YES   |
| wait/synch/mutex/innodb/fil_system_mutex              | YES     | YES   |
| wait/synch/mutex/innodb/flush_list_mutex              | YES     | YES   |
| wait/synch/mutex/innodb/fts_bg_threads_mutex          | NO      | NO    |
| wait/synch/mutex/innodb/fts_delete_mutex              | NO      | NO    |
| wait/synch/mutex/innodb/fts_optimize_mutex            | NO      | NO    |
| wait/synch/mutex/innodb/fts_doc_id_mutex              | NO      | NO    |
| wait/synch/mutex/innodb/fts_pll_tokenize_mutex        | NO      | NO    |
| wait/synch/mutex/innodb/log_flush_order_mutex         | YES     | YES   |
| wait/synch/mutex/innodb/hash_table_mutex              | YES     | YES   |
| wait/synch/mutex/innodb/ibuf_bitmap_mutex             | YES     | YES   |
| wait/synch/mutex/innodb/ibuf_mutex                    | YES     | YES   |
| wait/synch/mutex/innodb/ibuf_pessimistic_insert_mutex | YES     | YES   |
| wait/synch/mutex/innodb/log_sys_mutex                 | YES     | YES   |
| wait/synch/mutex/innodb/log_sys_write_mutex           | YES     | YES   |
| wait/synch/mutex/innodb/log_cmdq_mutex                | YES     | YES   |
| wait/synch/mutex/innodb/mutex_list_mutex              | YES     | YES   |
| wait/synch/mutex/innodb/page_cleaner_mutex            | YES     | YES   |
| wait/synch/mutex/innodb/page_zip_stat_per_index_mutex | YES     | YES   |
| wait/synch/mutex/innodb/purge_sys_pq_mutex            | YES     | YES   |
| wait/synch/mutex/innodb/recv_sys_mutex                | YES     | YES   |
| wait/synch/mutex/innodb/recv_writer_mutex             | YES     | YES   |
| wait/synch/mutex/innodb/redo_rseg_mutex               | YES     | YES   |
| wait/synch/mutex/innodb/noredo_rseg_mutex             | YES     | YES   |
| wait/synch/mutex/innodb/rw_lock_list_mutex            | YES     | YES   |
| wait/synch/mutex/innodb/rw_lock_mutex                 | YES     | YES   |
| wait/synch/mutex/innodb/srv_dict_tmpfile_mutex        | YES     | YES   |
| wait/synch/mutex/innodb/srv_innodb_monitor_mutex      | YES     | YES   |
| wait/synch/mutex/innodb/srv_misc_tmpfile_mutex        | YES     | YES   |
| wait/synch/mutex/innodb/srv_monitor_file_mutex        | YES     | YES   |
| wait/synch/mutex/innodb/buf_dblwr_mutex               | YES     | YES   |
| wait/synch/mutex/innodb/trx_undo_mutex                | YES     | YES   |
| wait/synch/mutex/innodb/trx_pool_mutex                | YES     | YES   |
| wait/synch/mutex/innodb/trx_pool_manager_mutex        | YES     | YES   |
| wait/synch/mutex/innodb/srv_sys_mutex                 | YES     | YES   |
| wait/synch/mutex/innodb/lock_mutex                    | YES     | YES   |
| wait/synch/mutex/innodb/lock_wait_mutex               | YES     | YES   |
| wait/synch/mutex/innodb/trx_mutex                     | YES     | YES   |
| wait/synch/mutex/innodb/srv_threads_mutex             | YES     | YES   |
| wait/synch/mutex/innodb/rtr_active_mutex              | YES     | YES   |
| wait/synch/mutex/innodb/rtr_match_mutex               | YES     | YES   |
| wait/synch/mutex/innodb/rtr_path_mutex                | YES     | YES   |
| wait/synch/mutex/innodb/rtr_ssn_mutex                 | YES     | YES   |
| wait/synch/mutex/innodb/trx_sys_mutex                 | YES     | YES   |
| wait/synch/mutex/innodb/thread_mutex                  | YES     | YES   |
| wait/synch/mutex/innodb/sync_array_mutex              | YES     | YES   |
| wait/synch/mutex/innodb/zip_pad_mutex                 | YES     | YES   |
| wait/synch/mutex/innodb/row_drop_list_mutex           | YES     | YES   |
| wait/synch/mutex/innodb/master_key_id_mutex           | YES     | YES   |
+-------------------------------------------------------+---------+-------+
58 rows in set (0.00 sec)

3.通过更新setup_consumers表来启用等待事件消费者。默认情况下,等待事件消费者是禁用的

mysql> UPDATE performance_schema.setup_consumers SET enabled = 'YES' WHERE name like 'events_waits%';
Query OK, 0 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0

可以通过查询setup_consumers表来验证是否启用了等待事件消费者。应该启用events_waits_current、events_waits_history和events_waits_history_long消费者。

mysql> SELECT * FROM performance_schema.setup_consumers;
+----------------------------------+---------+
| NAME                             | ENABLED |
+----------------------------------+---------+
| events_stages_current            | NO      |
| events_stages_history            | NO      |
| events_stages_history_long       | NO      |
| events_statements_current        | YES     |
| events_statements_history        | YES     |
| events_statements_history_long   | NO      |
| events_transactions_current      | NO      |
| events_transactions_history      | NO      |
| events_transactions_history_long | NO      |
| events_waits_current             | YES     |
| events_waits_history             | YES     |
| events_waits_history_long        | YES     |
| global_instrumentation           | YES     |
| thread_instrumentation           | YES     |
| statements_digest                | YES     |
+----------------------------------+---------+
15 rows in set (0.00 sec)

4.启用仪器和使用者后,运行要监视的工作负载。在这个例子中,mysqlslap负载模拟客户端用于模拟工作负载。

[mysql@localhost mysql]$ mysqlslap  -uroot -p123456 mysql  --auto-generate-sql --concurrency=100 --iterations=10 --number-of-queries=1000 --number-char-cols=6 --number-int-cols=6;
mysqlslap: [Warning] Using a password on the command line interface can be insecure.
Benchmark
        Average number of seconds to run all queries: 11.287 seconds
        Minimum number of seconds to run all queries: 11.172 seconds
        Maximum number of seconds to run all queries: 12.000 seconds
        Number of clients running queries: 100
        Average number of queries per client: 10




5.查询wait事件数据。在这个例子中,从events_waits_summary_global_by_event_name表中查询等待事件数据,该表聚合了events_waits_current、events_waits_history和events_waits_history_long表中的数据。数据按事件名称(EVENT_NAME)汇总,这是产生事件的工具的名称。汇总数据包括:
.COUNT_STAR 汇总等待事件的数量。

.SUM_TIMER_WAIT 汇总的定时等待事件的总等待时间。

.MIN_TIMER_WAIT 汇总的定时等待事件的最小等待时间。

.AVG_TIMER_WAIT 汇总的定时等待事件的平均等待时间。

.MAX_TIMER_WAIT 汇总的定时等待事件的最大等待时间。

下面的查询返回工具名称(EVENT_NAME)、等待事件数(COUNT_STAR)和该工具事件的总等待时间(SUM_TIMER_WAIT)。因为等待的时间默认以皮秒(万亿分之一秒)为单位,所以等待时间除以1000000000以毫秒为单位。数据按汇总的等待事件数量降序排列(COUNT_STAR)。可以调整ORDER BY子句,按总等待时间对数据进行排序。

mysql> SELECT EVENT_NAME, COUNT_STAR, SUM_TIMER_WAIT/1000000000 SUM_TIMER_WAIT_MS
    -> FROM performance_schema.events_waits_summary_global_by_event_name
    -> WHERE SUM_TIMER_WAIT > 0 AND EVENT_NAME LIKE 'wait/synch/mutex/innodb/%'
    -> ORDER BY COUNT_STAR DESC;
+--------------------------------------------------+------------+-------------------+
| EVENT_NAME                                       | COUNT_STAR | SUM_TIMER_WAIT_MS |
+--------------------------------------------------+------------+-------------------+
| wait/synch/mutex/innodb/buf_pool_mutex           |   10169469 |         1019.8992 |
| wait/synch/mutex/innodb/flush_list_mutex         |    6774758 |         1142.6652 |
| wait/synch/mutex/innodb/buf_dblwr_mutex          |    3387219 |          254.6546 |
| wait/synch/mutex/innodb/log_sys_mutex            |    1306588 |          236.5495 |
| wait/synch/mutex/innodb/sync_array_mutex         |     892914 |          214.6077 |
| wait/synch/mutex/innodb/rw_lock_list_mutex       |     524623 |           17.1254 |
| wait/synch/mutex/innodb/fil_system_mutex         |     449955 |          103.0167 |
| wait/synch/mutex/innodb/dict_sys_mutex           |     432432 |           44.9851 |
| wait/synch/mutex/innodb/log_sys_write_mutex      |     426698 |           32.9908 |
| wait/synch/mutex/innodb/log_flush_order_mutex    |     424318 |           76.9258 |
| wait/synch/mutex/innodb/lock_wait_mutex          |     423173 |          154.4097 |
| wait/synch/mutex/innodb/row_drop_list_mutex      |     423165 |          115.7234 |
| wait/synch/mutex/innodb/trx_mutex                |     148083 |           14.0274 |
| wait/synch/mutex/innodb/recalc_pool_mutex        |      42731 |           16.2913 |
| wait/synch/mutex/innodb/redo_rseg_mutex          |      36442 |           72.2952 |
| wait/synch/mutex/innodb/trx_sys_mutex            |      32181 |          595.8351 |
| wait/synch/mutex/innodb/lock_mutex               |      20761 |           49.5238 |
| wait/synch/mutex/innodb/srv_innodb_monitor_mutex |       6939 |            2.3340 |
| wait/synch/mutex/innodb/trx_undo_mutex           |       6550 |            0.8013 |
| wait/synch/mutex/innodb/trx_pool_mutex           |       2272 |        15580.2291 |
| wait/synch/mutex/innodb/innobase_share_mutex     |       2015 |            0.2733 |
| wait/synch/mutex/innodb/trx_pool_manager_mutex   |       1138 |            0.2584 |
| wait/synch/mutex/innodb/file_format_max_mutex    |       1021 |            0.0499 |
| wait/synch/mutex/innodb/page_cleaner_mutex       |        567 |            0.0531 |
| wait/synch/mutex/innodb/purge_sys_pq_mutex       |         70 |            0.0063 |
| wait/synch/mutex/innodb/srv_sys_mutex            |         52 |            0.0071 |
| wait/synch/mutex/innodb/ibuf_mutex               |         29 |            0.0022 |
| wait/synch/mutex/innodb/thread_mutex             |         27 |            0.0045 |
| wait/synch/mutex/innodb/recv_sys_mutex           |         22 |            0.0023 |
| wait/synch/mutex/innodb/buf_pool_zip_mutex       |         22 |            0.0020 |
| wait/synch/mutex/innodb/recv_writer_mutex        |          1 |            0.0002 |
| wait/synch/mutex/innodb/autoinc_mutex            |          1 |            0.0001 |
+--------------------------------------------------+------------+-------------------+
32 rows in set (0.02 sec)

注意:
上述结果集包括启动过程中产生的等待事件数据。要排除这些数据,您可以在启动后和运行工作负载之前立即截断events_waits_summary_global_by_event_name表。但truncate操作本身产生的等待事件数据量可以忽略不计。

mysql> TRUNCATE performance_schema.events_waits_summary_global_by_event_name;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT EVENT_NAME, COUNT_STAR, SUM_TIMER_WAIT/1000000000 SUM_TIMER_WAIT_MS
    -> FROM performance_schema.events_waits_summary_global_by_event_name
    -> WHERE SUM_TIMER_WAIT > 0 AND EVENT_NAME LIKE 'wait/synch/mutex/innodb/%'
    -> ORDER BY COUNT_STAR DESC;
+-----------------------------------------------+------------+-------------------+
| EVENT_NAME                                    | COUNT_STAR | SUM_TIMER_WAIT_MS |
+-----------------------------------------------+------------+-------------------+
| wait/synch/mutex/innodb/buf_pool_mutex        |        264 |            0.0381 |
| wait/synch/mutex/innodb/flush_list_mutex      |        176 |            0.0316 |
| wait/synch/mutex/innodb/buf_dblwr_mutex       |         88 |            0.0079 |
| wait/synch/mutex/innodb/log_sys_mutex         |         33 |            0.0079 |
| wait/synch/mutex/innodb/sync_array_mutex      |         22 |            0.0042 |
| wait/synch/mutex/innodb/dict_sys_mutex        |         11 |            0.0009 |
| wait/synch/mutex/innodb/fil_system_mutex      |         11 |            0.0022 |
| wait/synch/mutex/innodb/log_flush_order_mutex |         11 |            0.0020 |
| wait/synch/mutex/innodb/log_sys_write_mutex   |         11 |            0.0010 |
| wait/synch/mutex/innodb/lock_wait_mutex       |         11 |            0.0073 |
| wait/synch/mutex/innodb/row_drop_list_mutex   |         11 |            0.0067 |
| wait/synch/mutex/innodb/recalc_pool_mutex     |          1 |            0.0008 |
+-----------------------------------------------+------------+-------------------+
12 rows in set (0.02 sec)

MySQL 获取InnoDB表空间元数据

从INFORMATION_SCHEMA.FILES中获取InnoDB表空间元数据
INFORMATION_SCHEMA。FILES表提供了所有InnoDB表空间类型的元数据,包括file-per-table表空间、通用表空间、system表空间、临时表空间和undo表空间(如果存在)。

注意:
INNODB_SYS_TABLESPACES和INNODB_SYS_DATAFILES表也提供了关于InnoDB表空间的元数据,但数据仅限于file-per-table和通用表空间。

该查询从INFORMATION_SCHEMA.FILES表的字段中检索有关InnoDB系统表空间的元数据。与InnoDB无关的字段总是返回NULL,并且被排除在查询之外。

mysql> SELECT FILE_ID, FILE_NAME, FILE_TYPE, TABLESPACE_NAME, FREE_EXTENTS,
    -> TOTAL_EXTENTS, EXTENT_SIZE, INITIAL_SIZE, MAXIMUM_SIZE, AUTOEXTEND_SIZE, DATA_FREE, STATUS ENGINE
    -> FROM INFORMATION_SCHEMA.FILES WHERE TABLESPACE_NAME LIKE 'innodb_system' \G
*************************** 1. row ***************************
        FILE_ID: 0
      FILE_NAME: ./ibdata1
      FILE_TYPE: TABLESPACE
TABLESPACE_NAME: innodb_system
   FREE_EXTENTS: 2
  TOTAL_EXTENTS: 74
    EXTENT_SIZE: 1048576
   INITIAL_SIZE: 77594624
   MAXIMUM_SIZE: NULL
AUTOEXTEND_SIZE: 67108864
      DATA_FREE: 37748736
         ENGINE: NORMAL
1 row in set (0.01 sec)

对于InnoDB file-per-table和通用表空间,下面这个查询检索FILE_ID(等价于space ID)和FILE_NAME(包含路径信息)。file-per-table和通用表空间的文件扩展名是.ibd。

mysql> SELECT FILE_ID, FILE_NAME FROM INFORMATION_SCHEMA.FILES WHERE FILE_NAME LIKE '%.ibd%' ORDER BY FILE_ID;
+---------+----------------------------------------------------------+
| FILE_ID | FILE_NAME                                                |
+---------+----------------------------------------------------------+
|       5 | ./mysql/plugin.ibd                                       |
|       6 | ./mysql/servers.ibd                                      |
|       7 | ./mysql/help_topic.ibd                                   |
|       8 | ./mysql/help_category.ibd                                |
|       9 | ./mysql/help_relation.ibd                                |
|      10 | ./mysql/help_keyword.ibd                                 |
|      11 | ./mysql/time_zone_name.ibd                               |
|      12 | ./mysql/time_zone.ibd                                    |
|      13 | ./mysql/time_zone_transition.ibd                         |
|      14 | ./mysql/time_zone_transition_type.ibd                    |
|      15 | ./mysql/time_zone_leap_second.ibd                        |
|      16 | ./mysql/innodb_table_stats.ibd                           |
|      17 | ./mysql/innodb_index_stats.ibd                           |
|      18 | ./mysql/slave_relay_log_info.ibd                         |
|      19 | ./mysql/slave_master_info.ibd                            |
|      20 | ./mysql/slave_worker_info.ibd                            |
|      21 | ./mysql/gtid_executed.ibd                                |
|      22 | ./mysql/server_cost.ibd                                  |
|      23 | ./mysql/engine_cost.ibd                                  |
|      24 | ./sys/sys_config.ibd                                     |
|      37 | ./ts1.ibd                                                |
|      38 | ./ts2.ibd                                                |
|      51 | ./test/user.ibd                                          |
|      57 | ./mysql/test_index_1.ibd                                 |
|      58 | ./test/test_index_1.ibd                                  |
|      59 | ./employees/employees.ibd                                |
|      60 | ./employees/departments.ibd                              |
|      61 | ./employees/dept_manager.ibd                             |
|      62 | ./employees/dept_emp.ibd                                 |
|      63 | ./employees/titles.ibd                                   |
|      64 | ./employees/salaries.ibd                                 |
|     262 | ./test/bmsql_config.ibd                                  |
|     272 | ./test/bmsql_warehouse.ibd                               |
|     279 | ./test/bmsql_item.ibd                                    |
|     280 | ./test/bmsql_district.ibd                                |
|     281 | ./test/bmsql_customer.ibd                                |
|     283 | ./test/bmsql_history.ibd                                 |
|     284 | ./test/bmsql_new_order.ibd                               |
|     285 | ./test/bmsql_oorder.ibd                                  |
|     287 | ./test/bmsql_order_line.ibd                              |
|     289 | ./test/bmsql_stock.ibd                                   |
|     293 | ./ts01.ibd                                               |
|     294 | ./ts02.ibd                                               |
|     414 | ./employees/t.ibd                                        |
|     415 | ./employees/c.ibd                                        |
|     420 | ./test/ts03.ibd                                          |
|     423 | ./test/abc.ibd                                           |
|     425 | ./test/t3.ibd                                            |
|     426 | ./test/t4.ibd                                            |
|     427 | ./test/t7.ibd                                            |
|     428 | ./test/t8.ibd                                            |
|     472 | ./undo/opening_lines.ibd                                 |
|     473 | ./undo/FTS_00000000000001d9_BEING_DELETED.ibd            |
|     474 | ./undo/FTS_00000000000001d9_BEING_DELETED_CACHE.ibd      |
|     475 | ./undo/FTS_00000000000001d9_CONFIG.ibd                   |
|     476 | ./undo/FTS_00000000000001d9_DELETED.ibd                  |
|     477 | ./undo/FTS_00000000000001d9_DELETED_CACHE.ibd            |
|     478 | ./undo/FTS_00000000000001d9_00000000000002da_INDEX_1.ibd |
|     479 | ./undo/FTS_00000000000001d9_00000000000002da_INDEX_2.ibd |
|     480 | ./undo/FTS_00000000000001d9_00000000000002da_INDEX_3.ibd |
|     481 | ./undo/FTS_00000000000001d9_00000000000002da_INDEX_4.ibd |
|     482 | ./undo/FTS_00000000000001d9_00000000000002da_INDEX_5.ibd |
|     483 | ./undo/FTS_00000000000001d9_00000000000002da_INDEX_6.ibd |
|     484 | ./undo/t1.ibd                                            |
|     485 | ./ts3.ibd                                                |
|     487 | ./undo/big_table.ibd                                     |
|     489 | ./undo/key_block_size_4.ibd                              |
|     490 | ./ts4.ibd                                                |
|     491 | ./ts5.ibd                                                |
|     492 | ./ts6.ibd                                                |
|     494 | ./undo/t7.ibd                                            |
|     497 | ./undo/t8.ibd                                            |
|     498 | ./undo/employees.ibd                                     |
|     499 | ./undo/t9.ibd                                            |
|     500 | ./undo/t10.ibd                                           |
|     501 | ./undo/t11.ibd                                           |
|     503 | ./undo/t12.ibd                                           |
|     506 | ./undo/t13.ibd                                           |
|     507 | ./undo/t14.ibd                                           |
|     509 | ./test/parent.ibd                                        |
|     510 | ./test/child.ibd                                         |
|     523 | ./test/articles.ibd                                      |
|     524 | ./test/FTS_000000000000020c_BEING_DELETED.ibd            |
|     525 | ./test/FTS_000000000000020c_BEING_DELETED_CACHE.ibd      |
|     526 | ./test/FTS_000000000000020c_CONFIG.ibd                   |
|     527 | ./test/FTS_000000000000020c_DELETED.ibd                  |
|     528 | ./test/FTS_000000000000020c_DELETED_CACHE.ibd            |
|     529 | ./test/FTS_000000000000020c_0000000000000310_INDEX_1.ibd |
|     530 | ./test/FTS_000000000000020c_0000000000000310_INDEX_2.ibd |
|     531 | ./test/FTS_000000000000020c_0000000000000310_INDEX_3.ibd |
|     532 | ./test/FTS_000000000000020c_0000000000000310_INDEX_4.ibd |
|     533 | ./test/FTS_000000000000020c_0000000000000310_INDEX_5.ibd |
|     534 | ./test/FTS_000000000000020c_0000000000000310_INDEX_6.ibd |
|     535 | ./test/t1.ibd                                            |
+---------+----------------------------------------------------------+
94 rows in set (0.00 sec)

下面这个查询获取了InnoDB临时表空间的FILE_ID和FILE_NAME。临时表空间文件名以ibtmp为前缀。

mysql> SELECT FILE_ID, FILE_NAME FROM INFORMATION_SCHEMA.FILES WHERE FILE_NAME LIKE '%ibtmp%';
+---------+-----------+
| FILE_ID | FILE_NAME |
+---------+-----------+
|     537 | ./ibtmp1  |
+---------+-----------+
1 row in set (0.01 sec)

类似地,InnoDB的undo表空间文件名以undo为前缀。如果配置了单独的undo表空间,下面的查询返回了InnoDB undo表空间的FILE_ID和FILE_NAME。

mysql> SELECT FILE_ID, FILE_NAME FROM INFORMATION_SCHEMA.FILES WHERE FILE_NAME LIKE '%undo%';
+---------+----------------------------------------------------------+
| FILE_ID | FILE_NAME                                                |
+---------+----------------------------------------------------------+
|       1 | /mysqldata/mysql/undo/undo001                            |
|       2 | /mysqldata/mysql/undo/undo002                            |
|       3 | /mysqldata/mysql/undo/undo003                            |
+---------+----------------------------------------------------------+
3 rows in set (0.00 sec)

MySQL InnoDB INFORMATION_SCHEMA临时表信息表

InnoDB INFORMATION_SCHEMA临时表信息表

INNODB_TEMP_TABLE_INFO表为用户提供了一个活动的InnoDB临时表的快照。这张表包含了除InnoDB内部使用的优化过的临时表之外的所有用户和系统创建的临时表的元数据,这些临时表在给定的InnoDB实例中是活动的。

mysql> SHOW TABLES FROM INFORMATION_SCHEMA LIKE 'INNODB_TEMP%';
+---------------------------------------------+
| Tables_in_information_schema (INNODB_TEMP%) |
+---------------------------------------------+
| INNODB_TEMP_TABLE_INFO                      |
+---------------------------------------------+
1 row in set (0.00 sec)

下面这个例子将展示了INNODB_TEMP_TABLE_INFO表的特征。
1.创建一个单列的简单InnoDB临时表:

mysql> CREATE TEMPORARY TABLE t1 (c1 INT PRIMARY KEY) ENGINE=INNODB;
Query OK, 0 rows affected (0.01 sec)

2.查询INNODB_TEMP_TABLE_INFO表查看临时表的元数据。

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO\G
*************************** 1. row ***************************
            TABLE_ID: 537
                NAME: #sql1d89_101_0
              N_COLS: 4
               SPACE: 444
PER_TABLE_TABLESPACE: FALSE
       IS_COMPRESSED: FALSE
1 row in set (0.00 sec)

TABLE_ID是临时表的唯一标识符。NAME列显示了系统生成的临时表的名称,前缀是“#sql”。列数(N_COLS)是4而不是1,因为InnoDB总是创建3个隐藏表列(DB_ROW_ID、DB_TRX_ID和DB_ROLL_PTR)。PER_TABLE_TABLESPACE和IS_COMPRESSED仅对压缩的临时表报告为TRUE。

3.创建一个压缩的临时表。在此之前,确保innodb_file_format设置为Barracuda,这是创建压缩行格式的表所必需的。

mysql> SET GLOBAL innodb_file_format="Barracuda";
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> CREATE TEMPORARY TABLE t2 (c1 INT) ROW_FORMAT=COMPRESSED ENGINE=INNODB;
Query OK, 0 rows affected (0.00 sec)

4.再次查询INNODB_TEMP_TABLE_INFO表。

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO\G
*************************** 1. row ***************************
            TABLE_ID: 538
                NAME: #sql1d89_101_1
              N_COLS: 4
               SPACE: 536
PER_TABLE_TABLESPACE: TRUE
       IS_COMPRESSED: TRUE
*************************** 2. row ***************************
            TABLE_ID: 537
                NAME: #sql1d89_101_0
              N_COLS: 4
               SPACE: 444
PER_TABLE_TABLESPACE: FALSE
       IS_COMPRESSED: FALSE
2 rows in set (0.00 sec)

对于压缩临时表,PER_TABLE_TABLESPACE和IS_COMPRESSED报告为TRUE。压缩临时表的空间ID是不同的,因为压缩临时表是在单独的per-table表空间中创建的。非压缩临时表共享一个表空间(默认情况下是ibtmp1),并且报告相同的空间ID。

5.重启MySQL并查询INNODB_TEMP_TABLE_INFO表。

[root@localhost mysql]# service mysqld restart
Shutting down MySQL.... SUCCESS!
Starting MySQL... SUCCESS!

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO\G
Empty set (0.00 sec)

返回一个空集合,因为INNODB_TEMP_TABLE_INFO表和其中的数据在服务器关闭时没有持久化到磁盘。

6.创建一个新的临时表。

mysql> CREATE TEMPORARY TABLE t1 (c1 INT PRIMARY KEY) ENGINE=INNODB;
Query OK, 0 rows affected (0.00 sec)

7.查询INNODB_TEMP_TABLE_INFO表查看临时表的元数据。

mysql> CREATE TEMPORARY TABLE t1 (c1 INT PRIMARY KEY) ENGINE=INNODB;
Query OK, 0 rows affected (0.00 sec)

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO\G
*************************** 1. row ***************************
            TABLE_ID: 539
                NAME: #sql216d_2_0
              N_COLS: 4
               SPACE: 537
PER_TABLE_TABLESPACE: FALSE
       IS_COMPRESSED: FALSE
1 row in set (0.00 sec)

空间ID是新的,因为它是在服务器重启时动态生成的。