MySQL 訪問某資料 crash

來源:互聯網
上載者:User

癥狀: mysqldump 匯出資料 或者訪問某張表的或者某條資料的時候 mysql 直接 掛 了.
日誌如下:
InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 26400.
InnoDB: You may have to recover from a backup.
120217 15:45:53 InnoDB: Page dump in ascii and hex (16384 bytes):
len 16384; hex a922822af0c7bcef6d93dadcf4f63e8331d51e7a490667defbefxxxx..................
InnoDB: End of page dump

f 6 PE a r zx3120217 15:45:53   InnoDB: Page checksum 3458627726, prior-to-4.0.14-form checksum 796906866
InnoDB: stored checksum 2837611050, prior-to-4.0.14-form stored checksum 2410301789
InnoDB: Page lsn 836050554 1225156574, low 4 bytes of lsn at page end 2266014174
InnoDB: Page number (if stored to page already) 4039621871,
InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 4222022822
InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 26400.
InnoDB: You may have to recover from a backup.
InnoDB: It is also possible that your operating
InnoDB: system has corrupted its own file cache
InnoDB: and rebooting your computer removes the
InnoDB: error.
InnoDB: If the corrupt page is an index page
InnoDB: you can also try to fix the corruption
InnoDB: by dumping, dropping, and reimporting
InnoDB: the corrupt table. You can use CHECK
InnoDB: TABLE to scan your table for corruption.
InnoDB: See also http://dev.mysql.com/doc/refman/5.5/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
InnoDB: Ending processing because of a corrupt database page.
解決: 具體原因不明 參考文檔:http://cgaolei.iteye.com/blog/412157
http://space.itpub.net/94384/viewspace-604185

首先D:\cn.tsoft.system\mysql5.1.37\bin>mysqlcheck -uroot -pxxxx -P3306 --all-database 定位哪張表出了問題
執行結果如下:
tech_soft_drp_361new.pos_tradebill_cashredeem_item OK
mysqlcheck: Got error: 2013: Lost connection to MySQL server during query when e
xecuting 'CHECK TABLE ... '

由tech_soft_drp_361new.pos_tradebill_cashredeem_item 知道下一張表是 pos_tradebill_item

將my.ini 裡邊的#innodb_force_recovery=1 #號去掉 重啟mysql服務

然後將pos_tradebill_item 資料匯出到檔案(匯出的時候注意匯出資料的條數是否正確!)(記錄select count(*) from pos_tradebill_item 與匯出的條數對比)

找到pos_tradebill_item的建表語句.

刪除pos_tradebill_item表

重建pos_tradebill_item表.

匯入pos_tradebill_item資料(匯入資料的時候將innodb_force_recovery=1重新加上#號. innodb_force_recovery=1模式不支援寫)

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.