• mysql生成数据字典


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

    make

    [root@redis01 undrop-for-innodb]# make
    cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -I./include -c stream_parser.c
    cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -I./include  -pthread -lm  stream_parser.o -o stream_parser
    flex  sql_parser.l
    sql_parser.l:66: warning, the character range [
                                                   -Y] is ambiguous in a case-insensitive scanner
    sql_parser.l:66: warning, the character range [a] is ambiguous in a case-insensitive scanner
    bison  -o sql_parser.c sql_parser.y
    sql_parser.y: conflicts: 6 shift/reduce
    cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -I./include -c sql_parser.c
    lex.yy.c:3430: warning: ‘yyunput’ defined but not used
    lex.yy.c:3471: warning: ‘input’ defined but not used
    cc -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 used
    cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -I./include -c tables_dict.c
    cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -I./include -c print_data.c
    cc -D_FILE_OFFSET_BITS=64 -Wall -g -O3 -pipe -I./include -c check_data.c
    cc -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 -lm
    cc -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)
  • 相关阅读:
    (九十三)蓝牙的基本使用
    (九十二)加速计的用法(过期方法+新方法)
    (九十一)距离传感器的使用
    1060. Are They Equal (25)
    (九十)使用多个storyboard+代码实现控制器的分开管理
    (八十九)用AutoLayout实现动画和Label根据内容自动调整
    HDU 2013:蟠桃记
    HDU 2050:折线分割平面
    HDU 2042:不容易系列之二
    HDU 1465:不容易系列之一
  • 原文地址:https://www.cnblogs.com/omsql/p/9253234.html
Copyright © 2020-2023  润新知