
我的 MySQL 4.1 Windows 服務有時會崩潰,日誌中會出現以下行:
091218 9:31:25 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...
091218 9:31:33 InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 2 817025450.
InnoDB: Doing recovery: scanned up to log sequence number 2 817025450
091218 9:31:35 InnoDB: Flushing modified pages from the buffer pool...
091218 9:31:35 InnoDB: Started; log sequence number 2 817025450
C:\Programme\MySQL\MySQL Server 4.1\bin\mysqld-nt: ready for connections.
Version: '4.1.14-nt' socket: '' port: 3306 Official MySQL binary
100107 9:02:51 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...
100107 9:02:53 InnoDB: Starting log scan based on checkpoint at
InnoDB: log sequence number 2 953338420.
InnoDB: Doing recovery: scanned up to log sequence number 2 953338420
100107 9:02:53 InnoDB: Flushing modified pages from the buffer pool...
100107 9:02:53 InnoDB: Started; log sequence number 2 953338420
C:\Programme\MySQL\MySQL Server 4.1\bin\mysqld-nt: ready for connections.
Version: '4.1.14-nt' socket: '' port: 3306 Official MySQL binary
這些訊息並未指出任何具體問題。我可以做什麼來追蹤崩潰的根源?
答案1
停止資料庫
轉儲(或備份)您的資料庫。
刪除 data(windows) 或 /var(UNIX) 目錄中的所有內容。
重新啟動資料庫(現在資料庫將啟動)
恢復mysql目錄。
停止資料庫
恢復其他資料庫和表
啟動資料庫
答案2
我相信您需要設定設定innodb_force_recovery=2
並執行 mysql 轉儲,刪除原始資料庫目錄並使用匯入重新建立它。本文有更詳細的步驟。