首页 > 数据库技术 > 详细

MySQL 表空间恢复

时间:2021-04-29 18:16:15      阅读:19      评论:0      收藏:0      [点我收藏+]

dbsake是一个MySQL工具集,有解析frm文件的功能

项目地址:https://github.com/abg/dbsake/

1、下载

curl -s get.dbsake.net > dbsake
chmod u+x dbsake

2、解析frm文件,获取表创建SQL语句,比如我们要恢复test表

./dbsake frmdump test.frm

支持通配符

./dbsake frmdump *.frm

相关参数

$ dbsake
Usage: dbsake [options] <command>

Options:
  -d, --debug
  -q, --quiet
  -V, --version  Show the version and exit.
  -?, --help     Show this message and exit.

Commands:
  decode-tablename  Decode a MySQL filename.
  encode-tablename  Encode a MySQL table identifier.
  fincore           Report cached pages for a file.
  frmdump           解析frm文件,获取表创建语句
  help              显示帮助
  sandbox           Create a sandboxed MySQL instance.
  sieve             Filter and transform mysqldump output.
  uncache           Uncache file(s) from the OS page cache.
  upgrade-mycnf     Upgrade a MySQL option file.

 

3、获得表创建SQL后,到新建的一个数据库里面去执行,创建好表,比如表test

 

4、然后分离新建表的表空间文件

alter table test discard tablespace;

5、把备份的表空间文件test.ibd文件拷贝到新建数据库目录

6、导入备份的表空间文件

alter table test import tablespace;

7、恢复完成,检查数据

MySQL 表空间恢复

原文:https://www.cnblogs.com/lbnnbs/p/14718515.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!