Loading...
MySQL 9.5 Reference Manual 9.5의 6.6.1 ibd2sdi — InnoDB Tablespace SDI Extraction Utility의 한국어 번역본입니다.
아래의 경우에 피드백에서 신고해주신다면 반영하겠습니다.
감사합니다 :)
ibd2sdi는 InnoDB 테이블스페이스 파일에서 serialized dictionary information (SDI)을 추출하기 위한 유틸리티입니다.
SDI 데이터는 모든 영구 InnoDB 테이블스페이스 파일에 존재합니다.
ibd2sdi는 file-per-table 테이블스페이스 파일(*.ibd 파일), general tablespace 파일(*.ibd 파일), system tablespace 파일(ibdata* 파일), 그리고 데이터 딕셔너리 테이블스페이스(mysql.ibd)에서 실행할 수 있습니다.
temporary 테이블스페이스나 undo 테이블스페이스에서는 사용할 수 없습니다.
ibd2sdi는 서버가 실행 중일 때나 오프라인 상태일 때 사용할 수 있습니다.
DDL 작업, ROLLBACK 작업, 그리고 SDI와 관련된 undo 로그 퍼지 작업 동안에는 테이블스페이스에 저장된 SDI 데이터를 ibd2sdi가 읽지 못할 수 있는 짧은 시간 구간이 있을 수 있습니다.
ibd2sdi는 지정된 테이블스페이스에서 커밋되지 않은 SDI를 읽습니다.
redo 로그와 undo 로그는 액세스되지 않습니다.
ibd2sdi 유틸리티는 다음과 같이 호출합니다:
1ibd2sdi [options] file_name1 [file_name2 file_name3 ...]
ibd2sdi는 InnoDB 시스템 테이블스페이스와 같은 멀티파일 테이블스페이스를 지원하지만, 동시에 둘 이상의 테이블스페이스에 대해 실행할 수는 없습니다.
멀티파일 테이블스페이스의 경우, 각 파일을 지정해야 합니다:
1ibd2sdi ibdata1 ibdata2
멀티파일 테이블스페이스의 파일은 페이지 번호 오름차순 순서로 지정해야 합니다.
두 개의 연속된 파일이 동일한 공간 ID를 가지는 경우, 나중 파일은 이전 파일의 마지막 페이지 번호 + 1로 시작해야 합니다.
ibd2sdi는 id, type, data 필드를 포함하는 SDI를 JSON 포맷으로 출력합니다.
ibd2sdi는 다음과 같은 옵션을 지원합니다:
--help, -h| Property | Value |
|---|---|
| Command-Line Format | --help |
| Type | Boolean |
| Default Value | false |
help 메시지를 표시하고 종료합니다. 예:
1Usage: ./ibd2sdi [-v] [-c <strict-check>] [-d <dump file name>] [-n] filename1 [filenames] 2See http://dev.mysql.com/doc/refman/9.5/en/ibd2sdi.html for usage hints. 3 -h, --help Display this help and exit. 4 -v, --version Display version information and exit. 5 -#, --debug[=name] Output debug log. See 6 http://dev.mysql.com/doc/refman/9.5/en/dbug-package.html 7 -d, --dump-file=name 8 Dump the tablespace SDI into the file passed by user. 9 Without the filename, it will default to stdout 10 -s, --skip-data Skip retrieving data from SDI records. Retrieve only id 11 and type. 12 -i, --id=# Retrieve the SDI record matching the id passed by user. 13 -t, --type=# Retrieve the SDI records matching the type passed by 14 user. 15 -c, --strict-check=name 16 Specify the strict checksum algorithm by the user. 17 Allowed values are innodb, crc32, none. 18 -n, --no-check Ignore the checksum verification. 19 -p, --pretty Pretty format the SDI output.If false, SDI would be not 20 human readable but it will be of less size 21 (Defaults to on; use --skip-pretty to disable.) 22 23Variables (--variable-name=value) 24and boolean options {FALSE|TRUE} Value (after reading options) 25 --------------------------------- ---------------------------------------- 26debug (No default value) 27dump-file (No default value) 28skip-data FALSE 29id 0 30type 0 31strict-check crc32 32no-check FALSE 33pretty TRUE
--version, -v| Property | Value |
|---|---|
| Command-Line Format | --version |
| Type | Boolean |
| Default Value | false |
version 정보를 표시하고 종료합니다. 예:
1ibd2sdi Ver 9.5.0 for Linux on x86_64 (Source distribution)
--debug[=debug_options], -# [debug_options]| Property | Value |
|---|---|
| Command-Line Format | --debug=options |
| Type | String |
| Default Value | [none] |
debug 로그를 출력합니다. debug 옵션에 대해서는 Section 7.9.4, “The DBUG Package”를 참조하십시오.
1ibd2sdi --debug=d:t /tmp/ibd2sdi.trace
이 옵션은 MySQL이 WITH_DEBUG을 사용해 빌드된 경우에만 사용할 수 있습니다.
Oracle에서 제공하는 MySQL 릴리스 바이너리는 이 옵션을 사용하여 빌드되지 않습니다.
--dump-file=, -d| Property | Value |
|---|---|
| Command-Line Format | --dump-file=file |
| Type | File name |
| Default Value | [none] |
지정된 덤프 파일로 serialized dictionary information(SDI)을 덤프합니다.
덤프 파일을 지정하지 않으면, 테이블스페이스 SDI는 stdout으로 덤프됩니다.
1ibd2sdi --dump-file=file_name ../data/test/t1.ibd
--skip-data, -s| Property | Value |
|---|---|
| Command-Line Format | --skip-data |
| Type | Boolean |
| Default Value | false |
serialized dictionary information(SDI)에서 data 필드 값을 가져오는 것을 건너뛰고, id와 type 필드 값만 가져옵니다.
이 필드들은 SDI 레코드의 기본 키입니다.
1$> ibd2sdi --skip-data ../data/test/t1.ibd 2["ibd2sdi",\ 3,\ 4{\ 5 "type": 1,\ 6 "id": 330\ 7}\ 8,\ 9{\ 10 "type": 2,\ 11 "id": 7\ 12}\ 13]
--id=#, -i #| Property | Value |
|---|---|
| Command-Line Format | --id=# |
| Type | Integer |
| Default Value | 0 |
지정된 테이블 또는 테이블스페이스 객체 id와 일치하는 serialized dictionary information(SDI)을 가져옵니다.
객체 id는 객체 타입에 대해 고유합니다.
테이블 및 테이블스페이스 객체 ID는 mysql.tables와 mysql.tablespace 데이터 딕셔너리 테이블의 id 컬럼에서도 찾을 수 있습니다.
데이터 딕셔너리 테이블에 대한 정보는 Section 16.1, “Data Dictionary Schema”를 참조하십시오.
1$> ibd2sdi --id=7 ../data/test/t1.ibd 2["ibd2sdi",\ 3,\ 4{\ 5 "type": 2,\ 6 "id": 7,\ 7 "object":\ 8 {\ 9 "mysqld_version_id": 80003,\ 10 "dd_version": 80003,\ 11 "sdi_version": 1,\ 12 "dd_object_type": "Tablespace",\ 13 "dd_object": {\ 14 "name": "test/t1",\ 15 "comment": "",\ 16 "options": "",\ 17 "se_private_data": "flags=16417;id=2;server_version=80003;space_version=1;",\ 18 "engine": "InnoDB",\ 19 "files": [\ 20 {\ 21 "ordinal_position": 1,\ 22 "filename": "./test/t1.ibd",\ 23 "se_private_data": "id=2;"\ 24 }\ 25 ]\ 26 }\ 27}\ 28}\ 29]
--type=#, -t #| Property | Value |
|---|---|
| Command-Line Format | --type=# |
| Type | Enumeration |
| Default Value | 0 |
| Valid Values | 1<br>2 |
지정된 객체 타입과 일치하는 serialized dictionary information(SDI)을 가져옵니다.
SDI는 테이블(type=1)과 테이블스페이스(type=2) 객체에 대해 제공됩니다.
다음 예는 test 데이터베이스의 테이블스페이스 ts1에 대한 output을 보여줍니다:
1$> ibd2sdi --type=2 ../data/test/ts1.ibd 2["ibd2sdi",\ 3,\ 4{\ 5 "type": 2,\ 6 "id": 7,\ 7 "object":\ 8 {\ 9 "mysqld_version_id": 80003,\ 10 "dd_version": 80003,\ 11 "sdi_version": 1,\ 12 "dd_object_type": "Tablespace",\ 13 "dd_object": {\ 14 "name": "test/ts1",\ 15 "comment": "",\ 16 "options": "",\ 17 "se_private_data": "flags=16417;id=2;server_version=80003;space_version=1;",\ 18 "engine": "InnoDB",\ 19 "files": [\ 20 {\ 21 "ordinal_position": 1,\ 22 "filename": "./test/ts1.ibd",\ 23 "se_private_data": "id=2;"\ 24 }\ 25 ]\ 26 }\ 27}\ 28}\ 29]
InnoDB가 기본값 메타데이터를 처리하는 방식 때문에, 지정된 테이블 컬럼에 대해 DEFAULT로 정의되어 있지 않더라도, ibd2sdi output에는 기본값이 존재하고 비어 있지 않을 수 있습니다.
다음 문을 사용하여 데이터베이스 i에 생성된 두 테이블을 고려해 보십시오:
1CREATE TABLE t1 (c VARCHAR(16) NOT NULL); 2 3CREATE TABLE t2 (c VARCHAR(16) NOT NULL DEFAULT "Sakila");
ibd2sdi를 사용하면 컬럼 c의 default_value가 비어 있지 않고, 실제로 두 테이블 모두에서 다음과 같이 길이에 맞게 패딩되어 있음을 알 수 있습니다:
1$> ibd2sdi ../data/i/t1.ibd | grep -m1 '\"default_value\"' | cut -b34- | sed -e s/,// 2"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAA=" 3 4$> ibd2sdi ../data/i/t2.ibd | grep -m1 '\"default_value\"' | cut -b34- | sed -e s/,// 5"BlNha2lsYQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAA="
ibd2sdi output을 살펴보는 작업은 다음과 같이 **jq**와 같은 JSON 인식 유틸리티를 사용하면 더 쉬울 수 있습니다:
1$> ibd2sdi ../data/i/t1.ibd | jq '.[1]["object"]["dd_object"]["columns"][0]["default_value"]' 2"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAA=" 3 4$> ibd2sdi ../data/i/t2.ibd | jq '.[1]["object"]["dd_object"]["columns"][0]["default_value"]' 5"BlNha2lsYQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\nAAAAAAAAAAA="
자세한 내용은 MySQL Internals documentation을 참조하십시오.
--strict-check, -c| Property | Value |
|---|---|
| Command-Line Format | --strict-check=algorithm |
| Type | Enumeration |
| Default Value | crc32 |
| Valid Values | crc32<br>innodb<br>none |
읽은 페이지의 체크섬을 검증하기 위한 strict 체크섬 알고리즘을 지정합니다.
옵션에는 innodb, crc32, none이 있습니다.
다음 예에서는 strict 버전의 innodb 체크섬 알고리즘이 지정됩니다:
1ibd2sdi --strict-check=innodb ../data/test/t1.ibd
다음 예에서는 strict 버전의 crc32 체크섬 알고리즘이 지정됩니다:
1ibd2sdi -c crc32 ../data/test/t1.ibd
--strict-check 옵션을 지정하지 않으면, non-strict innodb, crc32, none 체크섬에 대해 검증이 수행됩니다.
--no-check, -n| Property | Value |
|---|---|
| Command-Line Format | --no-check |
| Type | Boolean |
| Default Value | false |
읽은 페이지에 대한 체크섬 검증을 건너뜁니다.
1ibd2sdi --no-check ../data/test/t1.ibd
--pretty, -p| Property | Value |
|---|---|
| Command-Line Format | --pretty |
| Type | Boolean |
| Default Value | false |
SDI 데이터를 JSON 프리티 프린트 포맷으로 출력합니다.
기본적으로 활성화되어 있습니다. 비활성화하면 SDI는 사람이 읽을 수 없지만 크기가 더 작아집니다.
비활성화하려면 --skip-pretty를 사용하십시오.
1ibd2sdi --skip-pretty ../data/test/t1.ibd
6.6 Administrative and Utility Programs
6.6.2 innochecksum — Offline InnoDB File Checksum Utility