1. 程式人生 > >一次服務器斷電,造成innodb引擎表(日誌表)損壞的解決辦法

一次服務器斷電,造成innodb引擎表(日誌表)損壞的解決辦法

ces init nal rem min something fault more caused

1、mysql日誌報錯

innodb引擎提示數據庫沒有正常關閉,報innodb錯誤

180112  0:49:28  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 2580576839
180112  0:49:28  InnoDB: Error: page 1 log sequence number 2580582651
InnoDB: is in the future! Current system log sequence number 2580576839.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: for more information.
180112  0:49:28  InnoDB: Error: page 5 log sequence number 2580579963
InnoDB: is in the future! Current system log sequence number 2580576839.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: for more information.
180112  0:49:29  InnoDB: Error: page 65565 log sequence number 2580577006
InnoDB: is in the future! Current system log sequence number 2580576839.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: for more information.
180112  0:49:29  InnoDB: Error: page 65566 log sequence number 2580577176
InnoDB: is in the future! Current system log sequence number 2580576839.
InnoDB: Your database may be corrupt or you may have copied the InnoDB
InnoDB: tablespace but not the InnoDB log files. See
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: for more information.
180112  0:49:29  InnoDB: Starting an apply batch of log records to the database...
InnoDB:
 Progress in percents: 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 180112  
0:49:29  InnoDB: Assertion failure in thread 140330795001600 in file 
rem0rec.c line 569
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
16:49:29 UTC - mysqld got signal 6 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed, 
something is definitely wrong and this may fail.


2、查看mysql服務狀態,提示mysql沒在運行,但是鎖定文件存在

ERROR! MySQL is not running,but lock file (/var/lock/subsys/mysql) exists


3、重啟mysql服務,提示錯誤

[root@mail subsys]# /etc/init.d/umail_mysqld restart
 ERROR! MySQL server PID file could not be found!
Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/u-mail/data/mysql/default.pid).

日誌報下面的錯誤:

180112  9:12:44 InnoDB: Cannot initialize created log files because
180112  9:12:44 InnoDB: data files are corrupt, or new data files were
180112  9:12:44 InnoDB: created when the database was started previous
180112  9:12:44 InnoDB: time but the database was not shut down
180112  9:12:44 InnoDB: normally after that.
180112  9:12:44 [ERROR] Plugin 'InnoDB' init function returned error.
180112  9:12:44 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.

將數據庫下ib_logfile文件移動走後(因為最開始看日誌的時候提示了InnoDB: tablespace but not the InnoDB log files. See ),可以重啟mysql服務。


4、以為重啟mysql成功後就可以,但是沒想到innodb引擎表已經損壞了。

日誌提示:

180112  9:37:40 [ERROR] Cannot find or open table umail/core_auth_log from
the internal data dictionary of InnoDB though the .frm file for the
table exists. Maybe you have deleted and recreated InnoDB data
files but have forgotten to delete the corresponding .frm files
of InnoDB tables, or you have moved .frm files to another database?
or, the table contains indexes that this version of the engine
doesn't support.
See http://dev.mysql.com/doc/refman/5.5/en/innodb-troubleshooting.html
how you can resolve the problem

(1)用phpmyadmin進去看提示正在使用,修復提示Unknown storage engine 'InnoDB '錯誤。

(2)mysql命令控制臺輸入show engines;查看,也沒有innodb引擎。


5、解決辦法

(1)使用drop tables 表名;,刪除innodb表

(2)停止與mysql服務相關的服務

(3)使用show processlist;命令查看是否有鎖定
(4)將創建這幾個表的sql文件放在一個路徑下
(5)到mysql命令控制臺輸入source /usr/local/kx-mail/data/mysql/default/base_table.sql導入
(6)重啟mysql服務






一次服務器斷電,造成innodb引擎表(日誌表)損壞的解決辦法