mysql生成数据字典

git clone https://github.com/twindb/undrop-for-innodb.git

make


[root@redis01 undrop-for-innodb]# makecc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -I./include -c stream_parser.ccc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -I./include -pthread -lm stream_parser.o -o stream_parserflex sql_parser.lsql_parser.l:66: warning, the character range [ -Y] is ambiguous in a case-insensitive scannersql_parser.l:66: warning, the character range [a] is ambiguous in a case-insensitive scannerbison -o sql_parser.c sql_parser.ysql_parser.y: conflicts: 6 shift/reducecc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -I./include -c sql_parser.clex.yy.c:3430: warning: ‘yyunput’ defined but not usedlex.yy.c:3471: warning: ‘input’ defined but not usedcc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -I./include -c c_parser.c./include/ctype-latin1.c:359: warning: ‘my_mb_wc_latin1’ defined but not used./include/ctype-latin1.c:372: warning: ‘my_wc_mb_latin1’ defined but not usedcc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -I./include -c tables_dict.ccc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -I./include -c print_data.ccc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -I./include -c check_data.ccc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -I./include sql_parser.o c_parser.o tables_dict.o print_data.o check_data.o -o c_parser -pthread -lmcc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -I./include -o innochecksum_changer innochecksum.c

View Code

创建恢复数据库

create database recovery;

抽取数据字典

create database recovery;./stream_parser -f /data/mysql//ibdata1 mkdir -p dumps/default ./c_parser -6f pages-ibdata1/FIL_PAGE_INDEX/0000000000000001.page -t dictionary/SYS_TABLES.sql > dumps/default/SYS_TABLES 2> dumps/default/SYS_TABLES.sql ./c_parser -6f pages-ibdata1/FIL_PAGE_INDEX/0000000000000003.page -t dictionary/SYS_INDEXES.sql > dumps/default/SYS_INDEXES 2> dumps/default/SYS_INDEXES.sql 加载数据 mysql -u root -p recovery < dictionary/SYS_TABLES.sql mysql -u root -p recovery < dictionary/SYS_INDEXES.sql mysql -u root -p recovery < dumps/default/SYS_TABLES.sql mysql -u root -p recovery < dumps/default/SYS_INDEXES.sql

  

查看数据信息

mysql> select * from SYS_TABLES where name like %tb%;+-------+----+--------+------+--------+---------+--------------+-------+| NAME | ID | N_COLS | TYPE | MIX_ID | MIX_LEN | CLUSTER_NAME | SPACE |+-------+----+--------+------+--------+---------+--------------+-------+| ht/tb | 40 | 2 | 33 | 0 | 80 | | 23 |+-------+----+--------+------+--------+---------+--------------+-------+1 row in set (0.00 sec)mysql> select * from SYS_INDEXES where table_id=40;+----------+----+---------+----------+------+-------+---------+| TABLE_ID | ID | NAME | N_FIELDS | TYPE | SPACE | PAGE_NO |+----------+----+---------+----------+------+-------+---------+| 40 | 41 | PRIMARY | 1 | 3 | 23 | 3 |+----------+----+---------+----------+------+-------+---------+1 row in set (0.00 sec)

 

相关文章