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是新的,因为它是在服务器重启时动态生成的。

MySQL InnoDB INFORMATION_SCHEMA度量表

InnoDB INFORMATION_SCHEMA度量表
MySQL 5.6.2中引入了INNODB_METRICS表,它将所有InnoDB性能和资源相关的计数器合并到一个INFORMATION_SCHEMA表中。

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts" \G
*************************** 1. row ***************************
           NAME: dml_inserts
      SUBSYSTEM: dml
          COUNT: 17263004
      MAX_COUNT: 17263004
      MIN_COUNT: NULL
      AVG_COUNT: 0.8178722213173183
    COUNT_RESET: 17263004
MAX_COUNT_RESET: 17263004
MIN_COUNT_RESET: NULL
AVG_COUNT_RESET: NULL
   TIME_ENABLED: 2023-05-10 09:02:54
  TIME_DISABLED: NULL
   TIME_ELAPSED: 21107214
     TIME_RESET: NULL
         STATUS: enabled
           TYPE: status_counter
        COMMENT: Number of rows inserted

启用、禁用和重置计数器
可以使用以下配置选项启用、禁用和重置计数器:
.innodb_monitor_enable:启用一个或多个计数器。

SET GLOBAL innodb_monitor_enable = [counter-name|module_name|pattern|all];

.innodb_monitor_disable:禁用一个或多个计数器。

SET GLOBAL innodb_monitor_disable = [counter-name|module_name|pattern|all];

.innodb_monitor_reset:将一个或多个计数器的计数值重置为零。

SET GLOBAL innodb_monitor_reset = [counter-name|module_name|pattern|all];

.innodb_monitor_reset_all:重置一个或多个计数器的所有值。在使用innodb_monitor_reset_all之前,必须禁用计数器。

SET GLOBAL innodb_monitor_reset_all = [counter-name|module_name|pattern|all];

你也可以在启动时使用MySQL服务器配置文件启用计数器和计数器模块。例如,要启用log模块、metadata_table_handles_opened和metadata_table_handles_closed计数器,在my.cnf配置文件的[mysqld]部分输入以下代码。

[mysqld]
innodb_monitor_enable = module_recovery,metadata_table_handles_opened,metadata_table_handles_closed

当在你的配置文件中启用多个计数器或模块时,你必须指定innodb_monitor_enable配置选项,后面跟着用逗号分隔的计数器和模块名称,如上例所示。只有innodb_monitor_enable选项可以在你的配置文件中使用。禁用和重置配置选项仅支持在命令行上。

注意:
因为每个计数器都会在服务器上增加一定程度的运行时开销,所以通常在试验和基准测试期间在测试和开发服务器上启用更多的计数器,并且仅在生产服务器上启用计数器以诊断已知问题或监视可能成为特定服务器和工作负载瓶颈的方面。

计数器
INNODB_METRICS表中的计数器可能会发生变化,所以要获取最新的计数器列表,可以在运行中的MySQL服务器上查询。

默认启用的计数器与“SHOW ENGINE INNODB STATUS”使用的计数器对应。SHOW ENGINE INNODB STATUS使用的计数器在系统级别上总是“on”的,但是你可以根据需要禁用INNODB_METRICS表的这些计数器。另外,计数器状态不是持久的。除非另外指定,否则计数器在服务器重启时将恢复到默认的启用或禁用状态。

如果你运行的程序会受到INNODB_METRICS表中新增或更改的影响,建议你查看发布说明,并在升级之前查询INNODB_METRICS表中的新版本。

mysql> SELECT name, subsystem, status FROM INFORMATION_SCHEMA.INNODB_METRICS ORDER BY NAME;
+------------------------------------------+---------------------+----------+
| name                                     | subsystem           | status   |
+------------------------------------------+---------------------+----------+
| adaptive_hash_pages_added                | adaptive_hash_index | disabled |
| adaptive_hash_pages_removed              | adaptive_hash_index | disabled |
| adaptive_hash_rows_added                 | adaptive_hash_index | disabled |
| adaptive_hash_rows_deleted_no_hash_entry | adaptive_hash_index | disabled |
| adaptive_hash_rows_removed               | adaptive_hash_index | disabled |
| adaptive_hash_rows_updated               | adaptive_hash_index | disabled |
| adaptive_hash_searches                   | adaptive_hash_index | enabled  |
| adaptive_hash_searches_btree             | adaptive_hash_index | enabled  |
| buffer_data_reads                        | buffer              | enabled  |
| buffer_data_written                      | buffer              | enabled  |
| buffer_flush_adaptive                    | buffer              | disabled |
| buffer_flush_adaptive_avg_pass           | buffer              | disabled |
| buffer_flush_adaptive_avg_time_est       | buffer              | disabled |
| buffer_flush_adaptive_avg_time_slot      | buffer              | disabled |
| buffer_flush_adaptive_avg_time_thread    | buffer              | disabled |
| buffer_flush_adaptive_pages              | buffer              | disabled |
| buffer_flush_adaptive_total_pages        | buffer              | disabled |
| buffer_flush_avg_page_rate               | buffer              | disabled |
| buffer_flush_avg_pass                    | buffer              | disabled |
| buffer_flush_avg_time                    | buffer              | disabled |
| buffer_flush_background                  | buffer              | disabled |
| buffer_flush_background_pages            | buffer              | disabled |
| buffer_flush_background_total_pages      | buffer              | disabled |
| buffer_flush_batches                     | buffer              | disabled |
| buffer_flush_batch_num_scan              | buffer              | disabled |
| buffer_flush_batch_pages                 | buffer              | disabled |
| buffer_flush_batch_scanned               | buffer              | disabled |
| buffer_flush_batch_scanned_per_call      | buffer              | disabled |
| buffer_flush_batch_total_pages           | buffer              | disabled |
| buffer_flush_lsn_avg_rate                | buffer              | disabled |
| buffer_flush_nei***or                    | buffer              | disabled |
| buffer_flush_nei***or_pages              | buffer              | disabled |
| buffer_flush_nei***or_total_pages        | buffer              | disabled |
| buffer_flush_n_to_flush_by_age           | buffer              | disabled |
| buffer_flush_n_to_flush_requested        | buffer              | disabled |
| buffer_flush_pct_for_dirty               | buffer              | disabled |
| buffer_flush_pct_for_lsn                 | buffer              | disabled |
| buffer_flush_sync                        | buffer              | disabled |
| buffer_flush_sync_pages                  | buffer              | disabled |
| buffer_flush_sync_total_pages            | buffer              | disabled |
| buffer_flush_sync_waits                  | buffer              | disabled |
| buffer_LRU_batches_evict                 | buffer              | disabled |
| buffer_LRU_batches_flush                 | buffer              | disabled |
| buffer_LRU_batch_evict_pages             | buffer              | disabled |
| buffer_LRU_batch_evict_total_pages       | buffer              | disabled |
| buffer_LRU_batch_flush_avg_pass          | buffer              | disabled |
| buffer_LRU_batch_flush_avg_time_est      | buffer              | disabled |
| buffer_LRU_batch_flush_avg_time_slot     | buffer              | disabled |
| buffer_LRU_batch_flush_avg_time_thread   | buffer              | disabled |
| buffer_LRU_batch_flush_pages             | buffer              | disabled |
| buffer_LRU_batch_flush_total_pages       | buffer              | disabled |
| buffer_LRU_batch_num_scan                | buffer              | disabled |
| buffer_LRU_batch_scanned                 | buffer              | disabled |
| buffer_LRU_batch_scanned_per_call        | buffer              | disabled |
| buffer_LRU_get_free_loops                | buffer              | disabled |
| buffer_LRU_get_free_search               | Buffer              | disabled |
| buffer_LRU_get_free_waits                | buffer              | disabled |
| buffer_LRU_search_num_scan               | buffer              | disabled |
| buffer_LRU_search_scanned                | buffer              | disabled |
| buffer_LRU_search_scanned_per_call       | buffer              | disabled |
| buffer_LRU_single_flush_failure_count    | Buffer              | disabled |
| buffer_LRU_single_flush_num_scan         | buffer              | disabled |
| buffer_LRU_single_flush_scanned          | buffer              | disabled |
| buffer_LRU_single_flush_scanned_per_call | buffer              | disabled |
| buffer_LRU_unzip_search_num_scan         | buffer              | disabled |
| buffer_LRU_unzip_search_scanned          | buffer              | disabled |
| buffer_LRU_unzip_search_scanned_per_call | buffer              | disabled |
| buffer_pages_created                     | buffer              | enabled  |
| buffer_pages_read                        | buffer              | enabled  |
| buffer_pages_written                     | buffer              | enabled  |
| buffer_page_read_blob                    | buffer_page_io      | disabled |
| buffer_page_read_fsp_hdr                 | buffer_page_io      | disabled |
| buffer_page_read_ibuf_bitmap             | buffer_page_io      | disabled |
| buffer_page_read_ibuf_free_list          | buffer_page_io      | disabled |
| buffer_page_read_index_ibuf_leaf         | buffer_page_io      | disabled |
| buffer_page_read_index_ibuf_non_leaf     | buffer_page_io      | disabled |
| buffer_page_read_index_inode             | buffer_page_io      | disabled |
| buffer_page_read_index_leaf              | buffer_page_io      | disabled |
| buffer_page_read_index_non_leaf          | buffer_page_io      | disabled |
| buffer_page_read_other                   | buffer_page_io      | disabled |
| buffer_page_read_system_page             | buffer_page_io      | disabled |
| buffer_page_read_trx_system              | buffer_page_io      | disabled |
| buffer_page_read_undo_log                | buffer_page_io      | disabled |
| buffer_page_read_xdes                    | buffer_page_io      | disabled |
| buffer_page_read_zblob                   | buffer_page_io      | disabled |
| buffer_page_read_zblob2                  | buffer_page_io      | disabled |
| buffer_page_written_blob                 | buffer_page_io      | disabled |
| buffer_page_written_fsp_hdr              | buffer_page_io      | disabled |
| buffer_page_written_ibuf_bitmap          | buffer_page_io      | disabled |
| buffer_page_written_ibuf_free_list       | buffer_page_io      | disabled |
| buffer_page_written_index_ibuf_leaf      | buffer_page_io      | disabled |
| buffer_page_written_index_ibuf_non_leaf  | buffer_page_io      | disabled |
| buffer_page_written_index_inode          | buffer_page_io      | disabled |
| buffer_page_written_index_leaf           | buffer_page_io      | disabled |
| buffer_page_written_index_non_leaf       | buffer_page_io      | disabled |
| buffer_page_written_other                | buffer_page_io      | disabled |
| buffer_page_written_system_page          | buffer_page_io      | disabled |
| buffer_page_written_trx_system           | buffer_page_io      | disabled |
| buffer_page_written_undo_log             | buffer_page_io      | disabled |
| buffer_page_written_xdes                 | buffer_page_io      | disabled |
| buffer_page_written_zblob                | buffer_page_io      | disabled |
| buffer_page_written_zblob2               | buffer_page_io      | disabled |
| buffer_pool_bytes_data                   | buffer              | enabled  |
| buffer_pool_bytes_dirty                  | buffer              | enabled  |
| buffer_pool_pages_data                   | buffer              | enabled  |
| buffer_pool_pages_dirty                  | buffer              | enabled  |
| buffer_pool_pages_free                   | buffer              | enabled  |
| buffer_pool_pages_misc                   | buffer              | enabled  |
| buffer_pool_pages_total                  | buffer              | enabled  |
| buffer_pool_reads                        | buffer              | enabled  |
| buffer_pool_read_ahead                   | buffer              | enabled  |
| buffer_pool_read_ahead_evicted           | buffer              | enabled  |
| buffer_pool_read_requests                | buffer              | enabled  |
| buffer_pool_size                         | server              | enabled  |
| buffer_pool_wait_free                    | buffer              | enabled  |
| buffer_pool_write_requests               | buffer              | enabled  |
| compression_pad_decrements               | compression         | disabled |
| compression_pad_increments               | compression         | disabled |
| compress_pages_compressed                | compression         | disabled |
| compress_pages_decompressed              | compression         | disabled |
| ddl_background_drop_indexes              | ddl                 | disabled |
| ddl_background_drop_tables               | ddl                 | disabled |
| ddl_log_file_alter_table                 | ddl                 | disabled |
| ddl_online_create_index                  | ddl                 | disabled |
| ddl_pending_alter_table                  | ddl                 | disabled |
| ddl_sort_file_alter_table                | ddl                 | disabled |
| dml_deletes                              | dml                 | enabled  |
| dml_inserts                              | dml                 | enabled  |
| dml_reads                                | dml                 | disabled |
| dml_updates                              | dml                 | enabled  |
| file_num_open_files                      | file_system         | enabled  |
| ibuf_merges                              | change_buffer       | enabled  |
| ibuf_merges_delete                       | change_buffer       | enabled  |
| ibuf_merges_delete_mark                  | change_buffer       | enabled  |
| ibuf_merges_discard_delete               | change_buffer       | enabled  |
| ibuf_merges_discard_delete_mark          | change_buffer       | enabled  |
| ibuf_merges_discard_insert               | change_buffer       | enabled  |
| ibuf_merges_insert                       | change_buffer       | enabled  |
| ibuf_size                                | change_buffer       | enabled  |
| icp_attempts                             | icp                 | disabled |
| icp_match                                | icp                 | disabled |
| icp_no_match                             | icp                 | disabled |
| icp_out_of_range                         | icp                 | disabled |
| index_page_discards                      | index               | disabled |
| index_page_merge_attempts                | index               | disabled |
| index_page_merge_successful              | index               | disabled |
| index_page_reorg_attempts                | index               | disabled |
| index_page_reorg_successful              | index               | disabled |
| index_page_splits                        | index               | disabled |
| innodb_activity_count                    | server              | enabled  |
| innodb_background_drop_table_usec        | server              | disabled |
| innodb_checkpoint_usec                   | server              | disabled |
| innodb_dblwr_pages_written               | server              | enabled  |
| innodb_dblwr_writes                      | server              | enabled  |
| innodb_dict_lru_count                    | server              | disabled |
| innodb_dict_lru_usec                     | server              | disabled |
| innodb_ibuf_merge_usec                   | server              | disabled |
| innodb_log_flush_usec                    | server              | disabled |
| innodb_master_active_loops               | server              | disabled |
| innodb_master_idle_loops                 | server              | disabled |
| innodb_master_purge_usec                 | server              | disabled |
| innodb_master_thread_sleeps              | server              | disabled |
| innodb_mem_validate_usec                 | server              | disabled |
| innodb_page_size                         | server              | enabled  |
| innodb_rwlock_sx_os_waits                | server              | enabled  |
| innodb_rwlock_sx_spin_rounds             | server              | enabled  |
| innodb_rwlock_sx_spin_waits              | server              | enabled  |
| innodb_rwlock_s_os_waits                 | server              | enabled  |
| innodb_rwlock_s_spin_rounds              | server              | enabled  |
| innodb_rwlock_s_spin_waits               | server              | enabled  |
| innodb_rwlock_x_os_waits                 | server              | enabled  |
| innodb_rwlock_x_spin_rounds              | server              | enabled  |
| innodb_rwlock_x_spin_waits               | server              | enabled  |
| lock_deadlocks                           | lock                | enabled  |
| lock_rec_locks                           | lock                | disabled |
| lock_rec_lock_created                    | lock                | disabled |
| lock_rec_lock_removed                    | lock                | disabled |
| lock_rec_lock_requests                   | lock                | disabled |
| lock_rec_lock_waits                      | lock                | disabled |
| lock_row_lock_current_waits              | lock                | enabled  |
| lock_row_lock_time                       | lock                | enabled  |
| lock_row_lock_time_avg                   | lock                | enabled  |
| lock_row_lock_time_max                   | lock                | enabled  |
| lock_row_lock_waits                      | lock                | enabled  |
| lock_table_locks                         | lock                | disabled |
| lock_table_lock_created                  | lock                | disabled |
| lock_table_lock_removed                  | lock                | disabled |
| lock_table_lock_waits                    | lock                | disabled |
| lock_timeouts                            | lock                | enabled  |
| log_checkpoints                          | recovery            | disabled |
| log_lsn_buf_pool_oldest                  | recovery            | disabled |
| log_lsn_checkpoint_age                   | recovery            | disabled |
| log_lsn_current                          | recovery            | disabled |
| log_lsn_last_checkpoint                  | recovery            | disabled |
| log_lsn_last_flush                       | recovery            | disabled |
| log_max_modified_age_async               | recovery            | disabled |
| log_max_modified_age_sync                | recovery            | disabled |
| log_num_log_io                           | recovery            | disabled |
| log_padded                               | recovery            | enabled  |
| log_pending_checkpoint_writes            | recovery            | disabled |
| log_pending_log_flushes                  | recovery            | disabled |
| log_waits                                | recovery            | enabled  |
| log_writes                               | recovery            | enabled  |
| log_write_requests                       | recovery            | enabled  |
| metadata_table_handles_closed            | metadata            | disabled |
| metadata_table_handles_opened            | metadata            | disabled |
| metadata_table_reference_count           | metadata            | disabled |
| os_data_fsyncs                           | os                  | enabled  |
| os_data_reads                            | os                  | enabled  |
| os_data_writes                           | os                  | enabled  |
| os_log_bytes_written                     | os                  | enabled  |
| os_log_fsyncs                            | os                  | enabled  |
| os_log_pending_fsyncs                    | os                  | enabled  |
| os_log_pending_writes                    | os                  | enabled  |
| os_pending_reads                         | os                  | disabled |
| os_pending_writes                        | os                  | disabled |
| purge_del_mark_records                   | purge               | disabled |
| purge_dml_delay_usec                     | purge               | disabled |
| purge_invoked                            | purge               | disabled |
| purge_resume_count                       | purge               | disabled |
| purge_stop_count                         | purge               | disabled |
| purge_undo_log_pages                     | purge               | disabled |
| purge_upd_exist_or_extern_records        | purge               | disabled |
| trx_active_transactions                  | transaction         | disabled |
| trx_commits_insert_update                | transaction         | disabled |
| trx_nl_ro_commits                        | transaction         | disabled |
| trx_rollbacks                            | transaction         | disabled |
| trx_rollbacks_savepoint                  | transaction         | disabled |
| trx_rollback_active                      | transaction         | disabled |
| trx_ro_commits                           | transaction         | disabled |
| trx_rseg_current_size                    | transaction         | disabled |
| trx_rseg_history_len                     | transaction         | enabled  |
| trx_rw_commits                           | transaction         | disabled |
| trx_undo_slots_cached                    | transaction         | disabled |
| trx_undo_slots_used                      | transaction         | disabled |
+------------------------------------------+---------------------+----------+
235 rows in set (0.03 sec)

计数器模块
模块名与INNODB_METRICS表中的SUBSYSTEM列对应,但不完全相同。相对于单独启用、禁用或重置计数器,您可以使用模块名称来快速启用、禁用或重置特定子系统的所有计数器。例如,使用module_dml启用与dml子系统关联的所有计数器。

mysql> SELECT name, subsystem, status FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem ='dml';
+-------------+-----------+----------+
| name        | subsystem | status   |
+-------------+-----------+----------+
| dml_reads   | dml       | disabled |
| dml_inserts | dml       | enabled  |
| dml_deletes | dml       | enabled  |
| dml_updates | dml       | enabled  |
+-------------+-----------+----------+
4 rows in set (0.00 sec)

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

mysql> SELECT name, subsystem, status FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE subsystem ='dml';
+-------------+-----------+---------+
| name        | subsystem | status  |
+-------------+-----------+---------+
| dml_reads   | dml       | enabled |
| dml_inserts | dml       | enabled |
| dml_deletes | dml       | enabled |
| dml_updates | dml       | enabled |
+-------------+-----------+---------+
4 rows in set (0.00 sec)

下面是innodb_monitor_enable和相关的配置选项可以使用的module_name值以及相应的子系统名称。

.module_adaptive_hash (subsystem = adaptive_hash_index)
.module_buffer (subsystem = buffer)
.module_buffer_page (subsystem = buffer_page_io)
.module_compress (subsystem = compression)
.module_ddl (subsystem = ddl)
.module_dml (subsystem = dml)
.module_file (subsystem = file_system)
.module_ibuf_system (subsystem = change_buffer)
.module_icp (subsystem = icp)
.module_index (subsystem = index)
.module_innodb (subsystem = innodb)
.module_lock (subsystem = lock)
.module_log (subsystem = recovery)
.module_metadata (subsystem = metadata)
.module_os (subsystem = os)
.module_purge (subsystem = purge)
.module_trx (subsystem = transaction)

使用INNODB_METRICS表计数器
下面这个例子演示了启用、禁用、重置计数器,以及查询INNODB_METRICS表中的计数器数据。

1.创建一个简单的InnoDB表;

mysql> use test
Database changed
mysql> CREATE TABLE t1 (c1 INT) ENGINE=INNODB;
Query OK, 0 rows affected (0.01 sec)

2.启用dml_inserts计数器。
先禁用dml_inserts计数器并将所有计数清零

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

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts" \G
*************************** 1. row ***************************
           NAME: dml_inserts
      SUBSYSTEM: dml
          COUNT: 17263007
      MAX_COUNT: 17263007
      MIN_COUNT: NULL
      AVG_COUNT: 0.817808627174022
    COUNT_RESET: 0
MAX_COUNT_RESET: 0
MIN_COUNT_RESET: NULL
AVG_COUNT_RESET: 0
   TIME_ENABLED: 2023-05-10 09:02:54
  TIME_DISABLED: 2024-01-09 16:37:13
   TIME_ELAPSED: 21108859
     TIME_RESET: NULL
         STATUS: disabled
           TYPE: status_counter
        COMMENT: Number of rows inserted
1 row in set (0.00 sec)

mysql> SET GLOBAL innodb_monitor_reset_all=dml_inserts;
Query OK, 0 rows affected (0.05 sec)

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts" \G
*************************** 1. row ***************************
           NAME: dml_inserts
      SUBSYSTEM: dml
          COUNT: 0
      MAX_COUNT: NULL
      MIN_COUNT: NULL
      AVG_COUNT: NULL
    COUNT_RESET: 0
MAX_COUNT_RESET: NULL
MIN_COUNT_RESET: NULL
AVG_COUNT_RESET: NULL
   TIME_ENABLED: NULL
  TIME_DISABLED: NULL
   TIME_ELAPSED: NULL
     TIME_RESET: NULL
         STATUS: disabled
           TYPE: status_counter
        COMMENT: Number of rows inserted
1 row in set (0.00 sec)

再启用dml_inserts计数器

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

在INNODB_METRICS表的COMMENT列中找到的关于dml_inserts计数器的描述:

mysql> SELECT NAME, COMMENT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts";
+-------------+-------------------------+
| NAME        | COMMENT                 |
+-------------+-------------------------+
| dml_inserts | Number of rows inserted |
+-------------+-------------------------+
1 row in set (0.00 sec)

3.查询INNODB_METRICS表中的dml_inserts计数器数据。因为没有执行DML操作,所以计数器值为零或NULL。TIME_ENABLED和TIME_ELAPSED值表示计数器上次启用的时间,以及从该时间起已经过去了多少秒。

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts" \G
*************************** 1. row ***************************
           NAME: dml_inserts
      SUBSYSTEM: dml
          COUNT: 0
      MAX_COUNT: 0
      MIN_COUNT: NULL
      AVG_COUNT: 0
    COUNT_RESET: 0
MAX_COUNT_RESET: 0
MIN_COUNT_RESET: NULL
AVG_COUNT_RESET: NULL
   TIME_ENABLED: 2024-01-09 16:40:33
  TIME_DISABLED: NULL
   TIME_ELAPSED: 150
     TIME_RESET: NULL
         STATUS: enabled
           TYPE: status_counter
        COMMENT: Number of rows inserted
1 row in set (0.00 sec)

4.向表中插入三行数据。

mysql> INSERT INTO t1 values(1);
Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO t1 values(2);
Query OK, 1 row affected (0.01 sec)

mysql> INSERT INTO t1 values(3);
Query OK, 1 row affected (0.00 sec)

5.再次查询INNODB_METRICS表获取dml_inserts计数器数据。现在有一些计数器的值已经递增,包括COUNT、MAX_COUNT、AVG_COUNT和COUNT_RESET。

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts"\G
*************************** 1. row ***************************
           NAME: dml_inserts
      SUBSYSTEM: dml
          COUNT: 3
      MAX_COUNT: 3
      MIN_COUNT: NULL
      AVG_COUNT: 0.00980392156862745
    COUNT_RESET: 3
MAX_COUNT_RESET: 3
MIN_COUNT_RESET: NULL
AVG_COUNT_RESET: NULL
   TIME_ENABLED: 2024-01-09 16:40:33
  TIME_DISABLED: NULL
   TIME_ELAPSED: 306
     TIME_RESET: NULL
         STATUS: enabled
           TYPE: status_counter
        COMMENT: Number of rows inserted
1 row in set (0.00 sec)

6.重置dml_inserts计数器,然后再次在INNODB_METRICS表中查询dml_inserts计数器数据。之前报告的%_RESET值,如COUNT_RESET和MAX_RESET,将重置为零。COUNT、MAX_COUNT和AVG_COUNT等值从计数器启用时开始收集数据,这些值不受重置的影响。

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

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts"\G
*************************** 1. row ***************************
           NAME: dml_inserts
      SUBSYSTEM: dml
          COUNT: 20
      MAX_COUNT: 20
      MIN_COUNT: NULL
      AVG_COUNT: 0.03424657534246575
    COUNT_RESET: 0
MAX_COUNT_RESET: 0
MIN_COUNT_RESET: NULL
AVG_COUNT_RESET: 0
   TIME_ENABLED: 2024-01-09 16:40:33
  TIME_DISABLED: 2024-01-09 16:50:17
   TIME_ELAPSED: 584
     TIME_RESET: NULL
         STATUS: disabled
           TYPE: status_counter
        COMMENT: Number of rows inserted
1 row in set (0.00 sec)

7.要重置所有计数器值,必须首先禁用计数器。禁用计数器将状态值设置为禁用。

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

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts"\G
*************************** 1. row ***************************
           NAME: dml_inserts
      SUBSYSTEM: dml
          COUNT: 20
      MAX_COUNT: 20
      MIN_COUNT: NULL
      AVG_COUNT: 0.03076923076923077
    COUNT_RESET: 0
MAX_COUNT_RESET: 0
MIN_COUNT_RESET: NULL
AVG_COUNT_RESET: 0
   TIME_ENABLED: 2024-01-09 16:40:33
  TIME_DISABLED: 2024-01-09 16:51:23
   TIME_ELAPSED: 650
     TIME_RESET: NULL
         STATUS: disabled
           TYPE: status_counter
        COMMENT: Number of rows inserted
1 row in set (0.01 sec)

注意:
计数器和模块名称支持通配符匹配。例如,可以指定dml_i%,而不是指定完整的dml_inserts计数器名称。还可以使用通配符匹配一次启用、禁用或重置多个计数器或模块。例如,指定dml_%来启用、禁用或重置所有以dml_%开头的计数器。

8.当计数器被禁用后,你可以使用innodb_monitor_reset_all选项重置所有计数器的值。所有值都设置为0或NULL。

mysql> SET GLOBAL innodb_monitor_reset_all=dml_inserts;
Query OK, 0 rows affected (0.05 sec)

mysql> SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME="dml_inserts"\G
*************************** 1. row ***************************
           NAME: dml_inserts
      SUBSYSTEM: dml
          COUNT: 0
      MAX_COUNT: NULL
      MIN_COUNT: NULL
      AVG_COUNT: NULL
    COUNT_RESET: 0
MAX_COUNT_RESET: NULL
MIN_COUNT_RESET: NULL
AVG_COUNT_RESET: NULL
   TIME_ENABLED: NULL
  TIME_DISABLED: NULL
   TIME_ELAPSED: NULL
     TIME_RESET: NULL
         STATUS: disabled
           TYPE: status_counter
        COMMENT: Number of rows inserted
1 row in set (0.00 sec)

MySQL InnoDB INFORMATION_SCHEMA缓冲池表

InnoDB INFORMATION_SCHEMA缓冲池表
InnoDB INFORMATION_SCHEMA缓冲池表提供了缓冲池状态信息和InnoDB缓冲池中页的元数据。这些表是在MySQL 5.6.2中引入的,后来移植到MySQL 5.5 (MySQL 5.5.28)和MySQL 5.1 (MySQL 5.1.66)。

InnoDB INFORMATION_SCHEMA缓冲池表包括下面这些表:

mysql> show tables from information_schema like 'INNODB_BUFFER%';
+-----------------------------------------------+
| Tables_in_information_schema (INNODB_BUFFER%) |
+-----------------------------------------------+
| INNODB_BUFFER_PAGE_LRU                        |
| INNODB_BUFFER_PAGE                            |
| INNODB_BUFFER_POOL_STATS                      |
+-----------------------------------------------+
3 rows in set (0.00 sec)

.INNODB_BUFFER_PAGE:保存InnoDB缓冲池中每一页的信息。

.INNODB_BUFFER_PAGE_LRU:保存了关于InnoDB缓冲池中页的信息,特别是它们在LRU列表中的排序方式,该列表决定了当缓冲池满时从缓冲池中清除哪些页。INNODB_BUFFER_PAGE_LRU表和INNODB_BUFFER_PAGE表有相同的列,不同的是INNODB_BUFFER_PAGE_LRU表有一个LRU_POSITION列而不是BLOCK_ID列。

.INNODB_BUFFER_POOL_STATS:缓冲池状态信息。大部分相同的信息由SHOW ENGINE INNODB STATUS输出提供,或者可以通过使用INNODB缓冲池服务器状态变量获得。

警示:
查询INNODB_BUFFER_PAGE表或INNODB_BUFFER_PAGE_LRU表会引入显著的性能开销。不要在生产系统上查询这些表,除非您意识到您的查询可能产生的性能影响,并确定它是可接受的。为了避免影响性能,在测试实例上重现您想要调查的问题,并在测试实例上运行您的查询。

查询INNODB_BUFFER_PAGE表中的系统数据
该查询通过排除TABLE_NAME值为NULL或包含表名中有斜杠/或句点.的表名表示用户自定义表,提供了包含系统数据的页面的大致数量。

mysql> select count(*) from information_schema.innodb_buffer_page
    -> where table_name is null or (instr(table_name, '/') = 0 and instr(table_name, '.') = 0);
+----------+
| count(*) |
+----------+
|   451428 |
+----------+
1 row in set (1.80 sec)

该查询返回包含系统数据的大约页数、缓冲池页数和包含系统数据的大约百分比的页数。

mysql> select
    -> (select count(*) from information_schema.innodb_buffer_page
    -> where table_name is null or (instr(table_name, '/') = 0 and instr(table_name, '.') = 0)
    -> ) as system_pages,
    -> (
    -> select count(*)
    -> from information_schema.innodb_buffer_page
    -> ) as total_pages,
    -> (
    -> select round((system_pages/total_pages) * 100)
    -> ) as system_page_percentage;
+--------------+-------------+------------------------+
| system_pages | total_pages | system_page_percentage |
+--------------+-------------+------------------------+
|       451428 |      524224 |                     86 |
+--------------+-------------+------------------------+
1 row in set (3.35 sec)

通过查询PAGE_TYPE的值,可以确定缓冲池中系统数据的类型。例如,下面的查询返回包含系统数据的页的10个不同的PAGE_TYPE值:

mysql> select distinct page_type from information_schema.innodb_buffer_page
    -> where table_name is null or (instr(table_name, '/') = 0 and instr(table_name, '.') = 0);
+-------------------+
| page_type         |
+-------------------+
| SYSTEM            |
| INODE             |
| IBUF_INDEX        |
| INDEX             |
| IBUF_BITMAP       |
| TRX_SYSTEM        |
| FILE_SPACE_HEADER |
| UNKNOWN           |
| UNDO_LOG          |
| EXTENT_DESCRIPTOR |
+-------------------+
10 rows in set (2.02 sec)

查询INNODB_BUFFER_PAGE表中的用户数据
这个查询通过统计TABLE_NAME值不为NULL且不像’%INNODB_SYS_TABLES%’的页面,提供了包含用户数据的页面的近似计数。

mysql> select count(*) from information_schema.innodb_buffer_page
    -> where table_name is not null and table_name not like '%innodb_sys_tables%';
+----------+
| count(*) |
+----------+
|    91067 |
+----------+
1 row in set (1.67 sec)

该查询返回包含用户数据的页面的大致数量、缓冲池页面的总数以及包含用户数据的页面的大致百分比。

mysql> select
    -> (select count(*) from information_schema.innodb_buffer_page
    -> where table_name is not null and (instr(table_name, '/') > 0 or instr(table_name, '.') > 0)
    -> ) as user_pages,
    -> (
    -> select count(*)
    -> from information_schema.innodb_buffer_page
    -> ) as total_pages,
    -> (
    -> select round((user_pages/total_pages) * 100)
    -> ) as user_page_percentage;
+------------+-------------+----------------------+
| user_pages | total_pages | user_page_percentage |
+------------+-------------+----------------------+
|      72796 |      524224 |                   14 |
+------------+-------------+----------------------+
1 row in set (3.31 sec)

这个查询将使用缓冲池中的页的用户定义的表标识出来:

mysql> select distinct table_name from information_schema.innodb_buffer_page
    -> where table_name is not null and (instr(table_name, '/') > 0 or instr(table_name, '.') > 0)
    -> and table_name not like '`mysql`.`innodb_%';
+--------------------------------------------------------+
| table_name                                             |
+--------------------------------------------------------+
| `undo`.`opening_lines`                                 |
| `undo`.`FTS_00000000000001d9_00000000000002da_INDEX_3` |
| `mysql`.`help_category`                                |
| `mysql`.`help_topic`                                   |
| `undo`.`big_table`                                     |
| `undo`.`key_block_size_4`                              |
| `sys`.`sys_config`                                     |
| `test`.`FTS_000000000000020c_DELETED_CACHE`            |
| `undo`.`FTS_00000000000001d9_BEING_DELETED`            |
| `undo`.`FTS_00000000000001d9_00000000000002da_INDEX_4` |
| `mysql`.`help_relation`                                |
| `undo`.`t8`                                            |
| `test`.`FTS_000000000000020c_0000000000000310_INDEX_1` |
| `mysql`.`slave_relay_log_info`                         |
| `undo`.`FTS_00000000000001d9_BEING_DELETED_CACHE`      |
| `undo`.`FTS_00000000000001d9_00000000000002da_INDEX_5` |
| `mysql`.`help_keyword`                                 |
| `undo`.`employees`                                     |
| `undo`.`t13`                                           |
| `test`.`FTS_000000000000020c_0000000000000310_INDEX_2` |
| `mysql`.`time_zone_name`                               |
| `mysql`.`slave_master_info`                            |
| `test`.`t7`                                            |
| `test`.`user`                                          |
| `undo`.`FTS_00000000000001d9_CONFIG`                   |
| `undo`.`FTS_00000000000001d9_00000000000002da_INDEX_6` |
| `undo`.`t9`                                            |
| `undo`.`t14`                                           |
| `test`.`articles`                                      |
| `test`.`FTS_000000000000020c_0000000000000310_INDEX_3` |
| `mysql`.`time_zone`                                    |
| `mysql`.`slave_worker_info`                            |
| `test`.`t8`                                            |
| `undo`.`FTS_00000000000001d9_DELETED`                  |
| `undo`.`t1`                                            |
| `undo`.`t10`                                           |
| `test`.`t1`                                            |
| `test`.`FTS_000000000000020c_BEING_DELETED`            |
| `test`.`FTS_000000000000020c_0000000000000310_INDEX_4` |
| `mysql`.`plugin`                                       |
| `mysql`.`gtid_executed`                                |
| `mysql`.`time_zone_transition`                         |
| `undo`.`FTS_00000000000001d9_DELETED_CACHE`            |
| `undo`.`t2`                                            |
| `undo`.`t11`                                           |
| `test`.`parent`                                        |
| `test`.`FTS_000000000000020c_BEING_DELETED_CACHE`      |
| `test`.`FTS_000000000000020c_0000000000000310_INDEX_5` |
| `mysql`.`server_cost`                                  |
| `mysql`.`time_zone_transition_type`                    |
| `mysql`.`servers`                                      |
| `undo`.`FTS_00000000000001d9_00000000000002da_INDEX_1` |
| `undo`.`t7`                                            |
| `test`.`child`                                         |
| `test`.`FTS_000000000000020c_CONFIG`                   |
| `test`.`FTS_000000000000020c_0000000000000310_INDEX_6` |
| `mysql`.`engine_cost`                                  |
| `mysql`.`time_zone_leap_second`                        |
| `undo`.`FTS_00000000000001d9_00000000000002da_INDEX_2` |
| `undo`.`t12`                                           |
| `test`.`abc`                                           |
| `test`.`FTS_000000000000020c_DELETED`                  |
+--------------------------------------------------------+
62 rows in set (1.81 sec)

查询INNODB_BUFFER_PAGE表中的索引数据
有关索引页的信息,请使用索引的名称查询INDEX_NAME列。例如,下面的查询返回在employees.salaries表上定义的emp_no索引的页数和总数据大小:

mysql> select index_name, count(*) as pages,
    -> round(sum(if(compressed_size = 0, @@global.innodb_page_size, compressed_size))/1024/1024)
    -> as 'total data (mb)'
    -> from information_schema.innodb_buffer_page
    -> where index_name='emp_no' and table_name = '`employees`.`salaries`';
+------------+-------+-----------------+
| index_name | pages | total data (mb) |
+------------+-------+-----------------+
| emp_no     |    44 |               1 |
+------------+-------+-----------------+
1 row in set (1.75 sec)

该查询返回在employees.salaries表上定义的所有索引的页数和总数据大小:

mysql> select index_name, count(*) as pages,
    -> round(sum(if(compressed_size = 0, @@global.innodb_page_size, compressed_size))/1024/1024)
    -> as 'total data (mb)'
    -> from information_schema.innodb_buffer_page
    -> where table_name = '`employees`.`salaries`'
    -> group by index_name;
+------------+-------+-----------------+
| index_name | pages | total data (mb) |
+------------+-------+-----------------+
| emp_no     |    44 |               1 |
| idx_salary |    65 |               1 |
| PRIMARY    |  6086 |              95 |
+------------+-------+-----------------+
3 rows in set (1.73 sec)

查询INNODB_BUFFER_PAGE_LRU表中的LRU_POSITION数据
INNODB_BUFFER_PAGE_LRU表保存了InnoDB缓冲池中页的信息,特别是当缓冲池满时,它们是如何排序的,这决定了哪些页需要从缓冲池中移除。该表的定义与INNODB_BUFFER_PAGE表相同,不同之处在于该表有一个LRU_POSITION列而不是BLOCK_ID列。

该查询计算LRU链表中特定位置上employees.employees表所使用的页数:

mysql> select count(lru_position) from information_schema.innodb_buffer_page_lru
    -> where table_name='`employees`.`employees`' and lru_position < 6570;
+---------------------+
| count(lru_position) |
+---------------------+
|                  13 |
+---------------------+
1 row in set (0.58 sec)

查询INNODB_BUFFER_POOL_STATS表
INNODB_BUFFER_POOL_STATS表提供了类似于SHOW ENGINE INNODB STATUS和INNODB缓冲池状态变量的信息。

mysql> select * from information_schema.innodb_buffer_pool_stats \G
*************************** 1. row ***************************
                         POOL_ID: 0
                       POOL_SIZE: 65528
                    FREE_BUFFERS: 46471
                  DATABASE_PAGES: 17936
              OLD_DATABASE_PAGES: 6640
         MODIFIED_DATABASE_PAGES: 0
              PENDING_DECOMPRESS: 4480
                   PENDING_READS: 0
               PENDING_FLUSH_LRU: 0
              PENDING_FLUSH_LIST: 0
                PAGES_MADE_YOUNG: 16823
            PAGES_NOT_MADE_YOUNG: 19769
           PAGES_MADE_YOUNG_RATE: 0
       PAGES_MADE_NOT_YOUNG_RATE: 0
               NUMBER_PAGES_READ: 857
            NUMBER_PAGES_CREATED: 17087
            NUMBER_PAGES_WRITTEN: 24505
                 PAGES_READ_RATE: 0
               PAGES_CREATE_RATE: 0
              PAGES_WRITTEN_RATE: 0
                NUMBER_PAGES_GET: 3448729
                        HIT_RATE: 0
    YOUNG_MAKE_PER_THOUSAND_GETS: 0
NOT_YOUNG_MAKE_PER_THOUSAND_GETS: 0
         NUMBER_PAGES_READ_AHEAD: 768
       NUMBER_READ_AHEAD_EVICTED: 0
                 READ_AHEAD_RATE: 0
         READ_AHEAD_EVICTED_RATE: 0
                    LRU_IO_TOTAL: 0
                  LRU_IO_CURRENT: 0
                UNCOMPRESS_TOTAL: 0
              UNCOMPRESS_CURRENT: 0
*************************** 2. row ***************************
                         POOL_ID: 1
                       POOL_SIZE: 65528
                    FREE_BUFFERS: 47000
                  DATABASE_PAGES: 17515
              OLD_DATABASE_PAGES: 6485
         MODIFIED_DATABASE_PAGES: 0
              PENDING_DECOMPRESS: 4051
                   PENDING_READS: 0
               PENDING_FLUSH_LRU: 0
              PENDING_FLUSH_LIST: 0
                PAGES_MADE_YOUNG: 0
            PAGES_NOT_MADE_YOUNG: 0
           PAGES_MADE_YOUNG_RATE: 0
       PAGES_MADE_NOT_YOUNG_RATE: 0
               NUMBER_PAGES_READ: 864
            NUMBER_PAGES_CREATED: 16651
            NUMBER_PAGES_WRITTEN: 23771
                 PAGES_READ_RATE: 0
               PAGES_CREATE_RATE: 0
              PAGES_WRITTEN_RATE: 0
                NUMBER_PAGES_GET: 5410983
                        HIT_RATE: 0
    YOUNG_MAKE_PER_THOUSAND_GETS: 0
NOT_YOUNG_MAKE_PER_THOUSAND_GETS: 0
         NUMBER_PAGES_READ_AHEAD: 832
       NUMBER_READ_AHEAD_EVICTED: 0
                 READ_AHEAD_RATE: 0
         READ_AHEAD_EVICTED_RATE: 0
                    LRU_IO_TOTAL: 0
                  LRU_IO_CURRENT: 0
                UNCOMPRESS_TOTAL: 0
              UNCOMPRESS_CURRENT: 0
*************************** 3. row ***************************
                         POOL_ID: 2
                       POOL_SIZE: 65528
                    FREE_BUFFERS: 46659
                  DATABASE_PAGES: 17733
              OLD_DATABASE_PAGES: 6565
         MODIFIED_DATABASE_PAGES: 0
              PENDING_DECOMPRESS: 4544
                   PENDING_READS: 0
               PENDING_FLUSH_LRU: 0
              PENDING_FLUSH_LIST: 0
                PAGES_MADE_YOUNG: 0
            PAGES_NOT_MADE_YOUNG: 0
           PAGES_MADE_YOUNG_RATE: 0
       PAGES_MADE_NOT_YOUNG_RATE: 0
               NUMBER_PAGES_READ: 755
            NUMBER_PAGES_CREATED: 16978
            NUMBER_PAGES_WRITTEN: 23908
                 PAGES_READ_RATE: 0
               PAGES_CREATE_RATE: 0
              PAGES_WRITTEN_RATE: 0
                NUMBER_PAGES_GET: 3462987
                        HIT_RATE: 0
    YOUNG_MAKE_PER_THOUSAND_GETS: 0
NOT_YOUNG_MAKE_PER_THOUSAND_GETS: 0
         NUMBER_PAGES_READ_AHEAD: 640
       NUMBER_READ_AHEAD_EVICTED: 0
                 READ_AHEAD_RATE: 0
         READ_AHEAD_EVICTED_RATE: 0
                    LRU_IO_TOTAL: 0
                  LRU_IO_CURRENT: 0
                UNCOMPRESS_TOTAL: 0
              UNCOMPRESS_CURRENT: 0
*************************** 4. row ***************************
                         POOL_ID: 3
                       POOL_SIZE: 65528
                    FREE_BUFFERS: 46644
                  DATABASE_PAGES: 17751
              OLD_DATABASE_PAGES: 6572
         MODIFIED_DATABASE_PAGES: 0
              PENDING_DECOMPRESS: 4528
                   PENDING_READS: 0
               PENDING_FLUSH_LRU: 0
              PENDING_FLUSH_LIST: 0
                PAGES_MADE_YOUNG: 2251
            PAGES_NOT_MADE_YOUNG: 17746
           PAGES_MADE_YOUNG_RATE: 0
       PAGES_MADE_NOT_YOUNG_RATE: 0
               NUMBER_PAGES_READ: 802
            NUMBER_PAGES_CREATED: 16961
            NUMBER_PAGES_WRITTEN: 23848
                 PAGES_READ_RATE: 0
               PAGES_CREATE_RATE: 0
              PAGES_WRITTEN_RATE: 0
                NUMBER_PAGES_GET: 4188354
                        HIT_RATE: 0
    YOUNG_MAKE_PER_THOUSAND_GETS: 0
NOT_YOUNG_MAKE_PER_THOUSAND_GETS: 0
         NUMBER_PAGES_READ_AHEAD: 768
       NUMBER_READ_AHEAD_EVICTED: 0
                 READ_AHEAD_RATE: 0
         READ_AHEAD_EVICTED_RATE: 0
                    LRU_IO_TOTAL: 0
                  LRU_IO_CURRENT: 0
                UNCOMPRESS_TOTAL: 0
              UNCOMPRESS_CURRENT: 0
*************************** 5. row ***************************
                         POOL_ID: 4
                       POOL_SIZE: 65528
                    FREE_BUFFERS: 46660
                  DATABASE_PAGES: 17729
              OLD_DATABASE_PAGES: 6564
         MODIFIED_DATABASE_PAGES: 0
              PENDING_DECOMPRESS: 4550
                   PENDING_READS: 0
               PENDING_FLUSH_LRU: 0
              PENDING_FLUSH_LIST: 0
                PAGES_MADE_YOUNG: 0
            PAGES_NOT_MADE_YOUNG: 0
           PAGES_MADE_YOUNG_RATE: 0
       PAGES_MADE_NOT_YOUNG_RATE: 0
               NUMBER_PAGES_READ: 792
            NUMBER_PAGES_CREATED: 16937
            NUMBER_PAGES_WRITTEN: 24222
                 PAGES_READ_RATE: 0
               PAGES_CREATE_RATE: 0
              PAGES_WRITTEN_RATE: 0
                NUMBER_PAGES_GET: 4314265
                        HIT_RATE: 0
    YOUNG_MAKE_PER_THOUSAND_GETS: 0
NOT_YOUNG_MAKE_PER_THOUSAND_GETS: 0
         NUMBER_PAGES_READ_AHEAD: 768
       NUMBER_READ_AHEAD_EVICTED: 0
                 READ_AHEAD_RATE: 0
         READ_AHEAD_EVICTED_RATE: 0
                    LRU_IO_TOTAL: 0
                  LRU_IO_CURRENT: 0
                UNCOMPRESS_TOTAL: 0
              UNCOMPRESS_CURRENT: 0
*************************** 6. row ***************************
                         POOL_ID: 5
                       POOL_SIZE: 65528
                    FREE_BUFFERS: 46748
                  DATABASE_PAGES: 17642
              OLD_DATABASE_PAGES: 6532
         MODIFIED_DATABASE_PAGES: 0
              PENDING_DECOMPRESS: 4548
                   PENDING_READS: 0
               PENDING_FLUSH_LRU: 0
              PENDING_FLUSH_LIST: 0
                PAGES_MADE_YOUNG: 0
            PAGES_NOT_MADE_YOUNG: 0
           PAGES_MADE_YOUNG_RATE: 0
       PAGES_MADE_NOT_YOUNG_RATE: 0
               NUMBER_PAGES_READ: 790
            NUMBER_PAGES_CREATED: 16852
            NUMBER_PAGES_WRITTEN: 23741
                 PAGES_READ_RATE: 0
               PAGES_CREATE_RATE: 0
              PAGES_WRITTEN_RATE: 0
                NUMBER_PAGES_GET: 3449085
                        HIT_RATE: 0
    YOUNG_MAKE_PER_THOUSAND_GETS: 0
NOT_YOUNG_MAKE_PER_THOUSAND_GETS: 0
         NUMBER_PAGES_READ_AHEAD: 768
       NUMBER_READ_AHEAD_EVICTED: 0
                 READ_AHEAD_RATE: 0
         READ_AHEAD_EVICTED_RATE: 0
                    LRU_IO_TOTAL: 0
                  LRU_IO_CURRENT: 0
                UNCOMPRESS_TOTAL: 0
              UNCOMPRESS_CURRENT: 0
*************************** 7. row ***************************
                         POOL_ID: 6
                       POOL_SIZE: 65528
                    FREE_BUFFERS: 46821
                  DATABASE_PAGES: 17571
              OLD_DATABASE_PAGES: 6506
         MODIFIED_DATABASE_PAGES: 0
              PENDING_DECOMPRESS: 4544
                   PENDING_READS: 0
               PENDING_FLUSH_LRU: 0
              PENDING_FLUSH_LIST: 0
                PAGES_MADE_YOUNG: 0
            PAGES_NOT_MADE_YOUNG: 0
           PAGES_MADE_YOUNG_RATE: 0
       PAGES_MADE_NOT_YOUNG_RATE: 0
               NUMBER_PAGES_READ: 727
            NUMBER_PAGES_CREATED: 16844
            NUMBER_PAGES_WRITTEN: 24005
                 PAGES_READ_RATE: 0
               PAGES_CREATE_RATE: 0
              PAGES_WRITTEN_RATE: 0
                NUMBER_PAGES_GET: 3852166
                        HIT_RATE: 0
    YOUNG_MAKE_PER_THOUSAND_GETS: 0
NOT_YOUNG_MAKE_PER_THOUSAND_GETS: 0
         NUMBER_PAGES_READ_AHEAD: 704
       NUMBER_READ_AHEAD_EVICTED: 0
                 READ_AHEAD_RATE: 0
         READ_AHEAD_EVICTED_RATE: 0
                    LRU_IO_TOTAL: 0
                  LRU_IO_CURRENT: 0
                UNCOMPRESS_TOTAL: 0
              UNCOMPRESS_CURRENT: 0
*************************** 8. row ***************************
                         POOL_ID: 7
                       POOL_SIZE: 65528
                    FREE_BUFFERS: 46651
                  DATABASE_PAGES: 17749
              OLD_DATABASE_PAGES: 6571
         MODIFIED_DATABASE_PAGES: 0
              PENDING_DECOMPRESS: 4512
                   PENDING_READS: 0
               PENDING_FLUSH_LRU: 0
              PENDING_FLUSH_LIST: 0
                PAGES_MADE_YOUNG: 0
            PAGES_NOT_MADE_YOUNG: 0
           PAGES_MADE_YOUNG_RATE: 0
       PAGES_MADE_NOT_YOUNG_RATE: 0
               NUMBER_PAGES_READ: 804
            NUMBER_PAGES_CREATED: 16945
            NUMBER_PAGES_WRITTEN: 23958
                 PAGES_READ_RATE: 0
               PAGES_CREATE_RATE: 0
              PAGES_WRITTEN_RATE: 0
                NUMBER_PAGES_GET: 3606901
                        HIT_RATE: 0
    YOUNG_MAKE_PER_THOUSAND_GETS: 0
NOT_YOUNG_MAKE_PER_THOUSAND_GETS: 0
         NUMBER_PAGES_READ_AHEAD: 768
       NUMBER_READ_AHEAD_EVICTED: 0
                 READ_AHEAD_RATE: 0
         READ_AHEAD_EVICTED_RATE: 0
                    LRU_IO_TOTAL: 0
                  LRU_IO_CURRENT: 0
                UNCOMPRESS_TOTAL: 0
              UNCOMPRESS_CURRENT: 0
8 rows in set (0.00 sec)

为了比较,SHOW ENGINE INNODB STATUS输出和INNODB缓冲池状态变量输出如下所示,基于相同的数据集。

mysql> show engine innodb status \G
......

----------------------
BUFFER POOL AND MEMORY
----------------------
Total large memory allocated 8795455488
Dictionary memory allocated 519969
Buffer pool size   524224
Free buffers       373654
Database pages     141626
Old database pages 52435
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 19074, not young 37515
0.00 youngs/s, 0.00 non-youngs/s
Pages read 6391, created 135255, written 191958
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: 141626, unzip_LRU len: 35757
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
----------------------
INDIVIDUAL BUFFER POOL INFO
----------------------
---BUFFER POOL 0
Buffer pool size   65528
Free buffers       46471
Database pages     17936
Old database pages 6640
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 16823, not young 19769
0.00 youngs/s, 0.00 non-youngs/s
Pages read 857, created 17087, written 24505
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: 17936, unzip_LRU len: 4480
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 1
Buffer pool size   65528
Free buffers       47000
Database pages     17515
Old database pages 6485
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 864, created 16651, written 23771
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: 17515, unzip_LRU len: 4051
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 2
Buffer pool size   65528
Free buffers       46659
Database pages     17733
Old database pages 6565
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 755, created 16978, written 23908
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: 17733, unzip_LRU len: 4544
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 3
Buffer pool size   65528
Free buffers       46644
Database pages     17751
Old database pages 6572
Modified db pages  0
Pending reads      0
Pending writes: LRU 0, flush list 0, single page 0
Pages made young 2251, not young 17746
0.00 youngs/s, 0.00 non-youngs/s
Pages read 802, created 16961, written 23848
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: 17751, unzip_LRU len: 4528
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 4
Buffer pool size   65528
Free buffers       46660
Database pages     17729
Old database pages 6564
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 792, created 16937, written 24222
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: 17729, unzip_LRU len: 4550
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 5
Buffer pool size   65528
Free buffers       46748
Database pages     17642
Old database pages 6532
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 790, created 16852, written 23741
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: 17642, unzip_LRU len: 4548
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 6
Buffer pool size   65528
Free buffers       46821
Database pages     17571
Old database pages 6506
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 727, created 16844, written 24005
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: 17571, unzip_LRU len: 4544
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
---BUFFER POOL 7
Buffer pool size   65528
Free buffers       46651
Database pages     17749
Old database pages 6571
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 804, created 16945, written 23958
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: 17749, unzip_LRU len: 4512
I/O sum[0]:cur[0], unzip sum[0]:cur[0]
......


mysql> show status like 'Innodb_buffer%';
+---------------------------------------+--------------------------------------------------+
| Variable_name                         | Value                                            |
+---------------------------------------+--------------------------------------------------+
| Innodb_buffer_pool_dump_status        | Dumping of buffer pool not started               |
| Innodb_buffer_pool_load_status        | Buffer pool(s) load completed at 230510  9:02:54 |
| Innodb_buffer_pool_resize_status      |                                                  |
| Innodb_buffer_pool_pages_data         | 141626                                           |
| Innodb_buffer_pool_bytes_data         | 2466910208                                       |
| Innodb_buffer_pool_pages_dirty        | 0                                                |
| Innodb_buffer_pool_bytes_dirty        | 0                                                |
| Innodb_buffer_pool_pages_flushed      | 154983                                           |
| Innodb_buffer_pool_pages_free         | 373654                                           |
| Innodb_buffer_pool_pages_misc         | 8944                                             |
| Innodb_buffer_pool_pages_total        | 524224                                           |
| Innodb_buffer_pool_read_ahead_rnd     | 0                                                |
| Innodb_buffer_pool_read_ahead         | 6016                                             |
| Innodb_buffer_pool_read_ahead_evicted | 0                                                |
| Innodb_buffer_pool_read_requests      | 31733470                                         |
| Innodb_buffer_pool_reads              | 376                                              |
| Innodb_buffer_pool_wait_free          | 0                                                |
| Innodb_buffer_pool_write_requests     | 15535407                                         |
+---------------------------------------+--------------------------------------------------+
18 rows in set (0.01 sec)

MySQL InnoDB INFORMATION_SCHEMA全文索引表

InnoDB INFORMATION_SCHEMA全文索引表
随着MySQL 5.6.4对InnoDB表的全文索引支持的引入,以下表被添加到INFORMATION_SCHEMA数据库中:

mysql> show tables from information_schema like 'INNODB_FT%';
+-------------------------------------------+
| Tables_in_information_schema (INNODB_FT%) |
+-------------------------------------------+
| INNODB_FT_CONFIG                          |
| INNODB_FT_BEING_DELETED                   |
| INNODB_FT_DELETED                         |
| INNODB_FT_DEFAULT_STOPWORD                |
| INNODB_FT_INDEX_TABLE                     |
| INNODB_FT_INDEX_CACHE                     |
+-------------------------------------------+
6 rows in set (0.00 sec)

.INNODB_FT_CONFIG:显示关于InnoDB表的全文索引和相关处理的元数据。

.INNODB_FT_BEING_DELETED:提供INNODB_FT_DELETED表的快照,仅在使用optimizer table执行维护时使用。当OPTIMIZE TABLE运行时,INNODB_FT_BEING_DELETED表被清空,doc_id从INNODB_FT_DELETED表中移除。因为INNODB_FT_BEING_DELETED的内容的生命周期通常很短,所以该表在监控或调试方面的用途有限。

.INNODB_FT_DELETED:从InnoDB表的全文索引中删除的记录。为了避免在DML操作中对InnoDB全文索引进行昂贵的索引重组,新删除的单词的信息被单独存储,在执行文本搜索时从搜索结果中过滤,并且只有在运行OPTIMIZE TABLE时才从主搜索索引中删除。

.INNODB_FT_DEFAULT_STOPWORD:保存在创建全文索引时默认使用的停用词列表。

.INNODB_FT_INDEX_TABLE:包含用于处理全文索引的文本搜索的倒排索引的数据。

.INNODB_FT_INDEX_CACHE:包含新插入的行在全文索引中的标记信息。为了避免DML操作过程中昂贵的索引重组,新索引词的信息被单独存储,并仅在优化表运行时、服务器关闭时或缓存大小超过innodb_ft_cache_size或innodb_ft_total_cache_size定义的限制时才与主搜索索引结合。

注意:
除了INNODB_FT_DEFAULT_STOPWORD表,你必须将innodb_ft_aux_table配置变量设置为包含全文索引的表名(database_name/table_name)。否则,InnoDB的全文索引INFORMATION_SCHEMA表显示为空。

InnoDB全文索引INFORMATION_SCHEMA表
这个例子使用一个带全文索引的表来演示全文索引INFORMATION_SCHEMA表中包含的数据。
1.创建一个包含全文索引的表并插入一些数据:

mysql> create table articles (
    -> id int unsigned auto_increment not null primary key,
    -> title varchar(200),
    -> body text,
    -> fulltext (title,body)
    -> ) engine=innodb;
Query OK, 0 rows affected (0.05 sec)

mysql> insert into articles (title,body) values
    -> ('MySQL Tutorial','DBMS stands for DataBase ...'),
    -> ('How To Use MySQL Well','After you went through a ...'),
    -> ('Optimizing MySQL','In this tutorial we will show ...'),
    -> ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
    -> ('MySQL vs. YourSQL','In the following database comparison ...'),
    -> ('MySQL Security','When configured properly, MySQL ...');
Query OK, 6 rows affected (0.01 sec)
Records: 6  Duplicates: 0  Warnings: 0

2.设置innodb_ft_aux_table变量为FULLTEXT索引表的名称。如果没有设置这个变量,除了INNODB_FT_DEFAULT_STOPWORD表之外,InnoDB的FULLTEXT INFORMATION_SCHEMA表将显示为空。

mysql> set global innodb_ft_aux_table = 'test/articles';
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like '%aux_table%';
+---------------------+---------------+
| Variable_name       | Value         |
+---------------------+---------------+
| innodb_ft_aux_table | test/articles |
+---------------------+---------------+
1 row in set (0.01 sec)

3.查询INNODB_FT_INDEX_CACHE表,它显示了在全文索引中新插入的行信息。为了避免DML操作期间昂贵的索引重组,新插入行的数据将保留在全文索引缓存中,直到优化表运行(或直到服务器关闭或超过缓存限制)。

mysql> select * from information_schema.innodb_ft_index_cache limit 5;
+------------+--------------+-------------+-----------+--------+----------+
| WORD       | FIRST_DOC_ID | LAST_DOC_ID | DOC_COUNT | DOC_ID | POSITION |
+------------+--------------+-------------+-----------+--------+----------+
| 1001       |            5 |           5 |         1 |      5 |        0 |
| after      |            3 |           3 |         1 |      3 |       22 |
| comparison |            6 |           6 |         1 |      6 |       44 |
| configured |            7 |           7 |         1 |      7 |       20 |
| database   |            2 |           6 |         2 |      2 |       31 |
+------------+--------------+-------------+-----------+--------+----------+
5 rows in set (0.00 sec)

4.启用innodb_optimize_fulltext_only,在包含全文索引的表上运行OPTIMIZE TABLE。此操作将全文索引缓存的内容刷新到主全文索引。innodb_optimize_fulltext_only改变了optimize_table语句在InnoDB表上的操作方式,并且是在对带有全文索引的InnoDB表进行维护操作时临时启用的。

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

mysql> show variables like 'innodb_optimize_fulltext_only';
+-------------------------------+-------+
| Variable_name                 | Value |
+-------------------------------+-------+
| innodb_optimize_fulltext_only | ON    |
+-------------------------------+-------+
1 row in set (0.01 sec)


mysql> optimize table articles;
+---------------+----------+----------+----------+
| Table         | Op       | Msg_type | Msg_text |
+---------------+----------+----------+----------+
| test.articles | optimize | status   | OK       |
+---------------+----------+----------+----------+
1 row in set (0.01 sec)

5.查询INNODB_FT_INDEX_TABLE表,查看主要全文索引中的数据信息,包括刚刚从全文索引缓存中刷新的数据信息。

mysql> select * from information_schema.innodb_ft_index_table limit 5;
+------------+--------------+-------------+-----------+--------+----------+
| WORD       | FIRST_DOC_ID | LAST_DOC_ID | DOC_COUNT | DOC_ID | POSITION |
+------------+--------------+-------------+-----------+--------+----------+
| 1001       |            5 |           5 |         1 |      5 |        0 |
| after      |            3 |           3 |         1 |      3 |       22 |
| comparison |            6 |           6 |         1 |      6 |       44 |
| configured |            7 |           7 |         1 |      7 |       20 |
| database   |            2 |           6 |         2 |      2 |       31 |
+------------+--------------+-------------+-----------+--------+----------+
5 rows in set (0.00 sec)

INNODB_FT_INDEX_CACHE表现在是空的,因为优化表操作刷新了全文索引缓存。

mysql> select * from information_schema.innodb_ft_index_cache limit 5;
Empty set (0.00 sec)

6.从test/articles表中删除一些记录。

mysql> delete from test.articles where id < 4;
Query OK, 3 rows affected (0.01 sec)

7.查询INNODB_FT_DELETED表。该表记录从全文索引中删除的行。为了避免DML操作期间昂贵的索引重组,新删除记录的信息被单独存储,在进行文本搜索时从搜索结果中过滤,在运行OPTIMIZE TABLE时从主搜索索引中删除。

mysql> select * from information_schema.innodb_ft_deleted;
+--------+
| DOC_ID |
+--------+
|      2 |
|      3 |
|      4 |
+--------+
3 rows in set (0.01 sec)

8.运行OPTIMIZE TABLE删除删除的记录。

mysql> optimize table articles;
+---------------+----------+----------+----------+
| Table         | Op       | Msg_type | Msg_text |
+---------------+----------+----------+----------+
| test.articles | optimize | status   | OK       |
+---------------+----------+----------+----------+
1 row in set (0.03 sec)

INNODB_FT_DELETED表现在应该是空的。

mysql> select * from information_schema.innodb_ft_deleted;
Empty set (0.00 sec)

9.查询INNODB_FT_CONFIG表。该表包含关于全文索引和相关处理的元数据:
.optimize_checkpoint_limit是optimize table运行结束的秒数。

.synced_doc_id是下一个要发布的DOC_ID。

.stopword_table_name是用户定义的停止词表的数据库/表名。如果没有用户定义的停用词表,该字段显示为空。

.use_stopword表示是否使用stopword表,stopword表在创建FULLTEXT索引时定义。

mysql> select * from information_schema.innodb_ft_config;
+---------------------------+-------+
| KEY                       | VALUE |
+---------------------------+-------+
| optimize_checkpoint_limit | 180   |
| synced_doc_id             | 8     |
| stopword_table_name       |       |
| use_stopword              | 1     |
+---------------------------+-------+
4 rows in set (0.00 sec)