2012年3月22日 星期四

FreeBSD 中 MySQL InnoDB 檔案損毀無法卸除問題解決

當 MySQL InnoDB 的資料庫檔案損毀造成無法載入,且無法下 Query 時,可以使用參數強制 InnoDB 跳過錯誤處理流程,讓我們可以將資料盡量 Dump 出來,或卸載資料庫。

my.cnf

[mysqld]
innodb_force_recovery = 4


MySQL 官方網站參數說明:

1 (SRV_FORCE_IGNORE_CORRUPT)

Let the server run even if it detects a corrupt page. Try to make SELECT * FROM tbl_name jump over corrupt index records and pages, which helps in dumping tables.

2 (SRV_FORCE_NO_BACKGROUND)

Prevent the main thread from running. If a crash would occur during the purge operation, this recovery value prevents it.

3 (SRV_FORCE_NO_TRX_UNDO)

Do not run transaction rollbacks after recovery.

4 (SRV_FORCE_NO_IBUF_MERGE)

Prevent insert buffer merge operations. If they would cause a crash, do not do them. Do not calculate table statistics.

5 (SRV_FORCE_NO_UNDO_LOG_SCAN)

Do not look at undo logs when starting the database: InnoDB treats even incomplete transactions as committed.

6 (SRV_FORCE_NO_LOG_REDO)

Do not do the log roll-forward in connection with recovery.


0 意見: