1INNOCHECKSUM(1)              MySQL Database System             INNOCHECKSUM(1)
2
3
4

NAME

6       innochecksum - offline InnoDB file checksum utility
7

SYNOPSIS

9       innochecksum [options] file_name
10

DESCRIPTION

12       innochecksum prints checksums for InnoDB files. This tool reads an
13       InnoDB tablespace file, calculates the checksum for each page, compares
14       the calculated checksum to the stored checksum, and reports mismatches,
15       which indicate damaged pages. It was originally developed to speed up
16       verifying the integrity of tablespace files after power outages but can
17       also be used after file copies. Because checksum mismatches cause
18       InnoDB to deliberately shut down a running server, it may be preferable
19       to use this tool rather than waiting for an in-production server to
20       encounter the damaged pages.
21
22       innochecksum cannot be used on tablespace files that the server already
23       has open. For such files, you should use CHECK TABLE to check tables
24       within the tablespace. Attempting to run innochecksum on a tablespace
25       that the server already has open will result in an “Unable to lock
26       file” error.
27
28       If checksum mismatches are found, you would normally restore the
29       tablespace from backup or start the server and attempt to use mysqldump
30       to make a backup of the tables within the tablespace.
31
32       Invoke innochecksum like this:
33
34           shell> innochecksum [options] file_name
35
36       innochecksum Options.PP innochecksum supports the following options.
37       For options that refer to page numbers, the numbers are zero-based.
38
39       ·   --help, -?
40
41           Displays command line help. Example usage:
42
43               shell> innochecksum --help
44
45       ·   --info, -I
46
47           Synonym for --help. Displays command line help. Example usage:
48
49               shell> innochecksum --info
50
51       ·   --version, -V
52
53           Displays version information. Example usage:
54
55               shell> innochecksum --version
56
57       ·   --verbose, -v
58
59           Verbose mode; prints a progress indicator to the log file every
60           five seconds. In order for the progress indicator to be printed,
61           the log file must be specified using the --log option. To turn on
62           verbose mode, run:
63
64               shell> innochecksum --verbose
65
66           To turn off verbose mode, run:
67
68               shell> innochecksum --verbose=FALSE
69
70           The --verbose option and --log option can be specified at the same
71           time. For example:
72
73               shell> innochecksum --verbose --log=/var/lib/mysql/test/logtest.txt
74
75           To locate the progress indicator information in the log file, you
76           can perform the following search:
77
78               shell> cat ./logtest.txt | grep -i "okay"
79
80           The progress indicator information in the log file appears similar
81           to the following:
82
83               page 1663 okay: 2.863% done
84               page 8447 okay: 14.537% done
85               page 13695 okay: 23.568% done
86               page 18815 okay: 32.379% done
87               page 23039 okay: 39.648% done
88               page 28351 okay: 48.789% done
89               page 33023 okay: 56.828% done
90               page 37951 okay: 65.308% done
91               page 44095 okay: 75.881% done
92               page 49407 okay: 85.022% done
93               page 54463 okay: 93.722% done
94               ...
95
96       ·   --count, -c
97
98           Print a count of the number of pages in the file and exit. Example
99           usage:
100
101               shell> innochecksum --count ../data/test/tab1.ibd
102
103       ·   --start-page=num, -s num
104
105           Start at this page number. Example usage:
106
107               shell> innochecksum --start-page=600 ../data/test/tab1.ibd
108
109           or:
110
111               shell> innochecksum -s 600 ../data/test/tab1.ibd
112
113       ·   --end-page=num, -e num
114
115           End at this page number. Example usage:
116
117               shell> innochecksum --end-page=700 ../data/test/tab1.ibd
118
119           or:
120
121               shell> innochecksum --p 700 ../data/test/tab1.ibd
122
123       ·   --page=num, -p num
124
125           Check only this page number. Example usage:
126
127               shell> innochecksum --page=701 ../data/test/tab1.ibd
128
129       ·   --strict-check, -C
130
131           Specify a strict checksum algorithm. Options include innodb, crc32,
132           and none.
133
134           In this example, the innodb checksum algorithm is specified:
135
136               shell> innochecksum --strict-check=innodb ../data/test/tab1.ibd
137
138           In this example, the crc32 checksum algorithm is specified:
139
140               shell> innochecksum -C crc32 ../data/test/tab1.ibd
141
142           The following conditions apply:
143
144           ·   If you do not specify the --strict-check option, innochecksum
145               validates against innodb, crc32 and none.
146
147           ·   If you specify the none option, only checksums generated by
148               none are allowed.
149
150           ·   If you specify the innodb option, only checksums generated by
151               innodb are allowed.
152
153           ·   If you specify the crc32 option, only checksums generated by
154               crc32 are allowed.
155
156       ·   --no-check, -n
157
158           Ignore the checksum verification when rewriting a checksum. This
159           option may only be used with the innochecksum --write option. If
160           the --write option is not specified, innochecksum will terminate.
161
162           In this example, an innodb checksum is rewritten to replace an
163           invalid checksum:
164
165               shell> innochecksum --no-check --write innodb ../data/test/tab1.ibd
166
167       ·   --allow-mismatches, -a
168
169           The maximum number of checksum mismatches allowed before
170           innochecksum terminates. The default setting is 0. If
171           --allow-mismatches=N, where N>=0, N mismatches are permitted and
172           innochecksum terminates at N+1. When --allow-mismatches is set to
173           0, innochecksum terminates on the first checksum mismatch.
174
175           In this example, an existing innodb checksum is rewritten to set
176           --allow-mismatches to 1.
177
178               shell> innochecksum --allow-mismatches=1 --write innodb ../data/test/tab1.ibd
179
180           With --allow-mismatches set to 1, if there is a mismatch at page
181           600 and another at page 700 on a file with 1000 pages, the checksum
182           is updated for pages 0-599 and 601-699. Because --allow-mismatches
183           is set to 1, the checksum tolerates the first mismatch and
184           terminates on the second mismatch, leaving page 600 and pages
185           700-999 unchanged.
186
187       ·   --write=name, -w num
188
189           Rewrite a checksum. When rewriting an invalid checksum, the
190           --no-check option must be used together with the --write option.
191           The --no-check option tells innochecksum to ignore verification of
192           the invalid checksum. You do not have to specify the --no-check
193           option if the current checksum is valid.
194
195           An algorithm must be specified when using the --write option.
196           Possible values for the --write option are:
197
198           ·   innodb: A checksum calculated in software, using the original
199               algorithm from InnoDB.
200
201           ·   crc32: A checksum calculated using the crc32 algorithm,
202               possibly done with a hardware assist.
203
204           ·   none: A constant number.
205
206           The --write option rewrites entire pages to disk. If the new
207           checksum is identical to the existing checksum, the new checksum is
208           not written to disk in order to minimize I/O.
209
210           innochecksum obtains an exclusive lock when the --write option is
211           used.
212
213           In this example, a crc32 checksum is written for tab1.ibd:
214
215               shell> innochecksum -w crc32 ../data/test/tab1.ibd
216
217           In this example, a crc32 checksum is rewritten to replace an
218           invalid crc32 checksum:
219
220               shell> innochecksum --no-check --write crc32 ../data/test/tab1.ibd
221
222       ·   --page-type-summary, -S
223
224           Display a count of each page type in a tablespace. Example usage:
225
226               shell> innochecksum --page-type-summary ../data/test/tab1.ibd
227
228           Sample output for --page-type-summary:
229
230               File::../data/test/tab1.ibd
231               ================PAGE TYPE SUMMARY==============
232               #PAGE_COUNT PAGE_TYPE
233               ===============================================
234                      2        Index page
235                      0        Undo log page
236                      1        Inode page
237                      0        Insert buffer free list page
238                      2        Freshly allocated page
239                      1        Insert buffer bitmap
240                      0        System page
241                      0        Transaction system page
242                      1        File Space Header
243                      0        Extent descriptor page
244                      0        BLOB page
245                      0        Compressed BLOB page
246                      0        Other type of page
247               ===============================================
248               Additional information:
249               Undo page type: 0 insert, 0 update, 0 other
250               Undo page state: 0 active, 0 cached, 0 to_free, 0 to_purge, 0 prepared, 0 other
251
252       ·   --page-type-dump, -D
253
254           Dump the page type information for each page in a tablespace to
255           stderr or stdout. Example usage:
256
257               shell> innochecksum --page-type-dump=/tmp/a.txt ../data/test/tab1.ibd
258
259       ·   --log, -l
260
261           Log output for the innochecksum tool. A log file name must be
262           provided. Log output contains checksum values for each tablespace
263           page. For uncompressed tables, LSN values are also provided. The
264           --log replaces the --debug option, which was available in earlier
265           releases. Example usage:
266
267               shell> innochecksum --log=/tmp/log.txt ../data/test/tab1.ibd
268
269           or:
270
271               shell> innochecksum -l /tmp/log.txt ../data/test/tab1.ibd
272
273       ·   - option.
274
275           Specify the - option to read from standard input. If the - option
276           is missing when “read from standard in” is expected, innochecksum
277           will output innochecksum usage information indicating that the “-”
278           option was omitted. Example usages:
279
280               shell> cat t1.ibd | innochecksum -
281
282           In this example, innochecksum writes the crc32 checksum algorithm
283           to a.ibd without changing the original t1.ibd file.
284
285               shell> cat t1.ibd | innochecksum --write=crc32 - > a.ibd
286       Running innochecksum on Multiple User-defined Tablespace Files.PP The
287       following examples demonstrate how to run innochecksum on multiple
288       user-defined tablespace files (.ibd files).
289
290       Run innochecksum for all tablespace (.ibd) files in the “test”
291       database:
292
293           shell> innochecksum ./data/test/*.ibd
294
295       Run innochecksum for all tablespace files (.ibd files) that have a file
296       name starting with “t”:
297
298           shell> innochecksum ./data/test/t*.ibd
299
300       Run innochecksum for all tablespace files (.ibd files) in the data
301       directory:
302
303           shell> innochecksum ./data/*/*.ibd
304
305
306           Note
307           Running innochecksum on multiple user-defined tablespace files is
308           not supported on Windows operating systems, as Windows shells such
309           as cmd.exe do not support glob pattern expansion. On Windows
310           systems, innochecksum must be run separately for each user-defined
311           tablespace file. For example:
312
313               cmd> innochecksum.exe t1.ibd
314               cmd> innochecksum.exe t2.ibd
315               cmd> innochecksum.exe t3.ibd
316       Running innochecksum on Multiple System Tablespace Files.PP By default,
317       there is only one InnoDB system tablespace file (ibdata1) but multiple
318       files for the system tablespace can be defined using the
319       innodb_data_file_path option. In the following example, three files for
320       the system tablespace are defined using the innodb_data_file_path
321       option: ibdata1, ibdata2, and ibdata3.
322
323           shell> ./bin/mysqld --no-defaults --innodb-data-file-path="ibdata1:10M;ibdata2:10M;ibdata3:10M:autoextend"
324
325       The three files (ibdata1, ibdata2, and ibdata3) form one logical system
326       tablespace. To run innochecksum on multiple files that form one logical
327       system tablespace, innochecksum requires the - option to read
328       tablespace files in from standard input, which is equivalent to
329       concatenating multiple files to create one single file. For the example
330       provided above, the following innochecksum command would be used:
331
332           shell> cat ibdata* | innochecksum -
333
334       Refer to the innochecksum options information for more information
335       about the “-” option.
336
337           Note
338           Running innochecksum on multiple files in the same tablespace is
339           not supported on Windows operating systems, as Windows shells such
340           as cmd.exe do not support glob pattern expansion. On Windows
341           systems, innochecksum must be run separately for each system
342           tablespace file. For example:
343
344               cmd> innochecksum.exe ibdata1
345               cmd> innochecksum.exe ibdata2
346               cmd> innochecksum.exe ibdata3
347
349       Copyright © 1997, 2019, Oracle and/or its affiliates. All rights
350       reserved.
351
352       This documentation is free software; you can redistribute it and/or
353       modify it only under the terms of the GNU General Public License as
354       published by the Free Software Foundation; version 2 of the License.
355
356       This documentation is distributed in the hope that it will be useful,
357       but WITHOUT ANY WARRANTY; without even the implied warranty of
358       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
359       General Public License for more details.
360
361       You should have received a copy of the GNU General Public License along
362       with the program; if not, write to the Free Software Foundation, Inc.,
363       51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
364       http://www.gnu.org/licenses/.
365
366

SEE ALSO

368       For more information, please refer to the MySQL Reference Manual, which
369       may already be installed locally and which is also available online at
370       http://dev.mysql.com/doc/.
371

AUTHOR

373       Oracle Corporation (http://dev.mysql.com/).
374
375
376
377MySQL 8.0                         09/06/2019                   INNOCHECKSUM(1)
Impressum