ibd2sdi — InnoDB表空间SDI提取实用程序

参考mysql8.0官方文档 https://dev.mysql.com/doc/refman/8.0/en/ibd2sdi.html

ibd2sdi是一个实用程序,用于表空间文件中提取 序列化的字典信息(SDI) InnoDBSDI数据存在于所有持久性InnoDB表空间文件中。

ibd2sdi可以在 每个 表文件空间文件(*.ibd文件), 常规表空间文件(*.ibd文件), 系统表空间 文件(ibdata*文件)和数据字典表空间(mysql.ibd)上运行。不支持将其与临时表空间或撤消表空间一起使用。

ibd2sdi可以在运行时或服务器离线时使用。 与SDI相关的DDL 操作, ROLLBACK操作和撤消日志清除操作期间, ibd2sdi 无法读取存储在表空间中的SDI数据的时间间隔可能很短

ibd2sdi从指定的表空间执行未提交的SDI读取。无法访问重做日志和撤消日志。

像这样 调用ibd2sdi实用程序:

shell> ibd2sdi [options] file_name1 [file_name2 file_name3 ...]

ibd2sdi支持像InnoDB系统表空间这样的多文件表空间,但是不能一次在多个表空间上运行。对于多文件表空间,请指定每个文件:

shell> ibd2sdi ibdata1 ibdata2

多文件表空间的文件必须按照升序页码的顺序指定。如果两个连续的文件具有相同的空间ID,则后一个文件必须以前一个文件的最后一页编号+ 1开头。

ibd2sdiJSON格式输出SDI(包含id,type和data字段)

ibd2sdi选项

ibd2sdi支持以下选项:

  • --help, -h

    显示命令行帮助。

    shell> ibd2sdi --help
    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.
      -#, --debug[=name]  Output debug log. See
                          http://dev.mysql.com/doc/refman/8.0/en/dbug-package.html
      -d, --dump-file=name 
                          Dump the tablespace SDI into the file passed by user.
                          Without the filename, it will default to stdout
      -s, --skip-data     Skip retrieving data from SDI records. Retrieve only id
                          and type.
      -i, --id=#          Retrieve the SDI record matching the id passed by user.
      -t, --type=#        Retrieve the SDI records matching the type passed by
                          user.
      -c, --strict-check=name 
                          Specify the strict checksum algorithm by the user.
                          Allowed values are innodb, crc32, none.
      -n, --no-check      Ignore the checksum verification.
      -p, --pretty        Pretty format the SDI output.If false, SDI would be not
                          human readable but it will be of less size
                          (Defaults to on; use --skip-pretty to disable.)
    
    Variables (--variable-name=value)
    and boolean options {FALSE|TRUE}  Value (after reading options)
    --------------------------------- ----------------------------------------
    debug                             (No default value)
    dump-file                         (No default value)
    skip-data                         FALSE
    id                                0
    type                              0
    strict-check                      crc32
    no-check                          FALSE
    pretty                            TRUE
  • --version, -v

    显示MySQL版本信息。

    shell> ibd2sdi --version
    ibd2sdi  Ver 8.0.3-dmr for Linux on x86_64 (Source distribution)
  • --debug[=debug_options], -# [debug_options]

    打印调试日志。有关调试选项,请参见 第29.5.4节“ DBUG软件包”

    shell> ibd2sdi --debug=d:t /tmp/ibd2sdi.trace
  • --dump-file=, -d

    将序列化的字典信息(SDI)转储到指定的转储文件中。如果未指定转储文件,则表空间SDI将转储到stdout

    shell> ibd2sdi --dump-file=file_name ../data/test/t1.ibd
  • --skip-data, -s

    跳过data从序列化字典信息(SDI)中检索字段值的操作,仅检索id和 type字段值,它们是SDI记录的主键。

    shell> ibd2sdi --skip-data ../data/test/t1.ibd
    ["ibd2sdi"
    ,
    {
    	"type": 1,
    	"id": 330
    }
    ,
    {
    	"type": 2,
    	"id": 7
    }
    ]
  • --id=#, -i #

    检索与指定表或表空间对象ID匹配的序列化字典信息(SDI)。对象ID对于对象类型是唯一的。表和表空间对象ID也在和 数据字典表id列中 找到有关数据字典表的信息,请参见 第14.1节“数据字典架构”。 mysql.tablesmysql.tablespace

    shell> ibd2sdi --id=7 ../data/test/t1.ibd
    ["ibd2sdi"
    ,
    {
    	"type": 2,
    	"id": 7,
    	"object":
    		{
        "mysqld_version_id": 80003,
        "dd_version": 80003,
        "sdi_version": 1,
        "dd_object_type": "Tablespace",
        "dd_object": {
            "name": "test/t1",
            "comment": "",
            "options": "",
            "se_private_data": "flags=16417;id=2;server_version=80003;space_version=1;",
            "engine": "InnoDB",
            "files": [
                {
                    "ordinal_position": 1,
                    "filename": "./test/t1.ibd",
                    "se_private_data": "id=2;"
                }
            ]
        }
    }
    }
    ]
  • --type=#, -t #

    检索与指定对象类型匹配的序列化字典信息(SDI)。为表(类型= 1)和表空间(类型= 2)对象提供了SDI。

    shell> ibd2sdi --type=2 ../data/test/t1.ibd
    ["ibd2sdi"
    ,
    {
    	"type": 2,
    	"id": 7,
    	"object":
    		{
        "mysqld_version_id": 80003,
        "dd_version": 80003,
        "sdi_version": 1,
        "dd_object_type": "Tablespace",
        "dd_object": {
            "name": "test/t1",
            "comment": "",
            "options": "",
            "se_private_data": "flags=16417;id=2;server_version=80003;space_version=1;",
            "engine": "InnoDB",
            "files": [
                {
                    "ordinal_position": 1,
                    "filename": "./test/t1.ibd",
                    "se_private_data": "id=2;"
                }
            ]
        }
    }
    }
    ]
  • --strict-check, -c

    指定严格的校验和算法,以验证读取的页面的校验和。选项包括 innodbcrc32,和 none

    在此示例中,innodb指定校验和算法的严格版本 

    shell> ibd2sdi --strict-check=innodb ../data/test/t1.ibd

    在此示例中,crc32指定校验和算法的严格版本 

    shell> ibd2sdi -c crc32 ../data/test/t1.ibd

    如果不指定 --strict-check选项,验证对不严格执行 innodbcrc32并 none校验。

  • --no-check, -n

    跳过读取页面的校验和验证。

    shell> ibd2sdi --no-check ../data/test/t1.ibd
  • --pretty, -p

    以JSON漂亮打印格式输出SDI数据。默认启用。如果禁用,则SDI不可读,但尺寸较小。使用--skip-pretty到禁用。

    shell> ibd2sdi --skip-pretty ../data/test/t1.ibd
原文地址:https://www.cnblogs.com/zh-dream/p/12128515.html