记一次mysql 数据页损坏造成自动重启的故障

故障现象:数据库每隔1两分钟自动重启

mysql 数据页损坏,报错信息

2022-10-16T02:11:57.533853+08:00 0 [ERROR] InnoDB: Database page corruption on disk or a failed file read of page [page id: space=194, page number=919648]. You may have to recover from a backup.
2022-10-16T02:11:57.533890+08:00 0 [Note] InnoDB: Page dump in ascii and hex (16384 bytes):
 len 16384; hex ****************
InnoDB: End of page dump
2022-10-16T02:11:57.580896+08:00 0 [Note] InnoDB: Uncompressed page, stored checksum in field1 3147464949, calculated checksums for field1: crc32 3490016883/4212497287, innodb 3685546551, none 3735928559, stored checksum in field2 3147464949, calculated checksums for field2: crc32 3490016883/4212497287, innodb 2938505374, none 3735928559,  page LSN 324 3221513577, low 4 bytes of LSN at page end 3221513577, page number (if stored to page already) 919648, space id (if created with >= MySQL-4.1.1 and stored already) 194
InnoDB: Page may be an index page where index id is 447
2022-10-16T02:11:57.580966+08:00 0 [Note] InnoDB: Index 447 is `***` in table `***`.`***`
2022-10-16T02:11:57.580975+08:00 0 [Note] InnoDB: It is also possible that your operating system has corrupted its own file cache and rebooting your computer removes the error. If the corrupt page is an index page. You can also try to fix the corruption by dumping, dropping, and reimporting the corrupt table. You can use CHECK TABLE to scan your table for corruption. Please refer to http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html for information about forcing recovery.
2022-10-16T02:11:57.581225+08:00 0 [ERROR] InnoDB: Database page corruption on disk or a failed file read of page [page id: space=194, page number=919648]. You may have to recover from a backup.

查看对应的数据页信息:

SELECT * FROM `information_schema`.`INNODB_SYS_INDEXES` WHERE INDEX_ID='447';
SELECT * FROM `information_schema`.`INNODB_SYS_TABLES` WHERE TABLE_ID='96';

数据恢复:my.cnf配置文件将innodb_force_recovery 设置1,2,3,4,分别尝试启动mysql,均失败。设置为6时数据库可以正常启动,但由于5,6会永久的修改当前的文件内容,造成不可逆的数据丢失,无法保证数据完整性,此方案不可行。查看主库的当天备份,由于数据页错误,备份也是失败的,于是决定在从库做全备,复制到主库上进行恢复。

`````````````````

ps:如果是单节点数据库,无备份,无从库,遇到此情况为了最大程度的保留数据,可进行如下操作:

(1)innodb_force_recovery =6 启动后,删除对应的错误索引,innodb_force_recovery 设置为0后重新启动,看故障是否消除;

(2)若没有消除innodb_force_recovery =6 启动后,重建表,alter table t engine=innodb,设置为0重新启动,看故障是否消除;

(3)若没有消除innodb_force_recovery =6 启动后,dump备份导出数据,重新导入数据;设置为0重新启动,看故障是否消除;

(4)若没有消除innodb_force_recovery =6 启动后,drop掉相关表;设置为0重新启动,看故障是否消除;

`````````````````

可能引起故障原因:电源故障,硬盘故障,驱动程序错误,内核错误,或某些罕见的MySQL错误等。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

LOST_9

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值