在MySQL 8.0之前InnoDB存储表的结构和数据时,分别存储在frm文件和ibd文件。而在MySQL 8.0的时候全都存到了ibd文件里。因此在MySQL 系统表记录的表信息丢失后我们需要从ibd文件中来获取表结构信息。
Oracle 将frm文件的信息及更多信息移动到叫做序列化字典信息(Serialized Dictionary Information,SDI),SDI被写在ibd文件内部,它是数据字典包含的信息的一个冗余副本。为了从ibd文件中提取SDI信息,Oracle提供了一个应用程序 ibd2sdi。 ibd2sdi工具可以运行在通用表空间文件(.ibd)、系统表空间文件(ibdata)以及数据字典表空间文件(mysql.ibd)。它不支持用于临时表空间文件及undo表空间文件。
ibd2sdi命令支持如下选项:
[root@kaiyuan04 qkn]# ibd2sdi --help
ibd2sdi Ver 8.0.28 for Linux on x86_64 (MySQL Community Server - GPL)
Copyright (c) 2015, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Usage: ibd2sdi [-v] [-c <strict-check>] [-d <dump file name>] [-n] filename1 [filenames]
See http://dev.mysql.com/doc/refman/8.0/en/ibd2sdi.html for usage hints.
-h, --help Display this help and exit.
-v, --version Display version information and exit.
-d, --dump-file=name
Dump the tablespace SDI into the file passed by user.