MySQL 表修复 MyISAM & InnoDB

DBA兄弟忘记删除N天来的全局备份

数据库服务器被写满了

我一开始以为像上次一样,是大量的增量备份占据了硬盘空间,在/var/lib/mysql/DBNAME下误删了几个日志表文件

然后发现不是这个问题,大囧!

 

 

SALE_RECORDY由于数据库错误关闭,导致无法读取,引擎用的是 MyISAM 如下修复

 [root@DBSERVER DBNAME]# myisamchk SALE_RECORD.MYI
Checking MyISAM file: SALE_RECORD.MYI
Data records: 1249940   Deleted blocks:       0
myisamchk: warning: Table is marked as crashed
myisamchk: warning: 2 clients are using or haven't closed the table properly
- check file-size
myisamchk: warning: Size of datafile is: 77496320        Should be: 77496280
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1
myisamchk: error: Found 1249941 keys of 1249940
MyISAM-table 'SALE_RECORD.MYI' is corrupted
Fix it using switch "-r" or "-o"
[root@DBSERVER DBNAME]# myisamchk -r SALE_RECORD.MYI
- recovering (with sort) MyISAM-table 'SALE_RECORD.MYI'
Data records: 1249940
- Fixing index 1

 

 

 

action_20_090119表用了 InnoDB 引擎,无法修复,action_20_090119.frm被我删了,数据库里看不到那张表,但是用create table语言也无法新增,于是新建了一个表action_20_070119,表结构相同,然后在/var/lib/mysql/DBNAME下mv action_20_070119.frm action_20_090119.frm,注意user and group 都要是mysql 然后进数据库看,愉悦了~

 

 

 

你可能感兴趣的:(MySQL)