參考mysql8.0官方文檔 https://dev.mysql.com/doc/refman/8.0/en/ibd2sdi.html
ibd2sdi是一個實用程序,用於從表空間文件中提取 序列化的字典信息(SDI) InnoDB
。SDI數據存在於所有持久性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開頭。
ibd2sdi以JSON
格式輸出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.tables
mysql.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
指定嚴格的校驗和算法,以驗證讀取的頁面的校驗和。選項包括
innodb
,crc32
,和none
。在此示例中,
innodb
指定了校驗和算法的嚴格版本 :shell> ibd2sdi --strict-check=innodb ../data/test/t1.ibd
在此示例中,
crc32
指定了校驗和算法的嚴格版本 :shell> ibd2sdi -c crc32 ../data/test/t1.ibd
如果不指定
--strict-check
選項,驗證對不嚴格執行innodb
,crc32
並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