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

SEE ALSO

372       For more information, please refer to the MySQL Reference Manual, which
373       may already be installed locally and which is also available online at
374       http://dev.mysql.com/doc/.
375

AUTHOR

377       Oracle Corporation (http://dev.mysql.com/).
378
379
380
381MySQL 8.0                         03/06/2020                   INNOCHECKSUM(1)
Impressum