• MySQL数据库断电修复(Database page corruption on disk or a failed)


     

    目录

    ​编辑

    一、报错信息

    二、解决方案

    2.1 修改配置

    2.2导出数据脚本

    2.3 删除ib_logfile0、ib_logfile1、ibdata1

    2.4 配置my.cnf

    2.5 将数据导入MySQL数据库


    一、报错信息


    启动日志如下:

    1. 2022-09-30 15:46:10 7078 [Note] Plugin 'FEDERATED' is disabled.
    2. 2022-09-30 15:46:10 7078 [Note] InnoDB: Using atomics to ref count buffer pool pages
    3. 2022-09-30 15:46:10 7078 [Note] InnoDB: The InnoDB memory heap is disabled
    4. 2022-09-30 15:46:10 7078 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
    5. 2022-09-30 15:46:10 7078 [Note] InnoDB: Memory barrier is not used
    6. 2022-09-30 15:46:10 7078 [Note] InnoDB: Compressed tables use zlib 1.2.3
    7. 2022-09-30 15:46:10 7078 [Note] InnoDB: Using Linux native AIO
    8. 2022-09-30 15:46:10 7078 [Note] InnoDB: Using CPU crc32 instructions
    9. 2022-09-30 15:46:10 7078 [Note] InnoDB: Initializing buffer pool, size = 128.0M
    10. 2022-09-30 15:46:10 7078 [Note] InnoDB: Completed initialization of buffer pool
    11. 2022-09-30 15:46:10 7078 [Note] InnoDB: Highest supported file format is Barracuda.
    12. 2022-09-30 15:46:10 7078 [Note] InnoDB: Log scan progressed past the checkpoint lsn 3029362122819
    13. 2022-09-30 15:46:10 7078 [Note] InnoDB: Database was not shutdown normally!
    14. 2022-09-30 15:46:10 7078 [Note] InnoDB: Starting crash recovery.
    15. 2022-09-30 15:46:10 7078 [Note] InnoDB: Reading tablespace information from the .ibd files...
    16. 2022-09-30 15:46:11 7078 [Note] InnoDB: Restoring possible half-written data pages
    17. 2022-09-30 15:46:11 7078 [Note] InnoDB: from the doublewrite buffer...
    18. InnoDB: Doing recovery: scanned up to log sequence number 3029367365632
    19. InnoDB: Doing recovery: scanned up to log sequence number 3029372608512
    20. InnoDB: Doing recovery: scanned up to log sequence number 3029377851392
    21. InnoDB: Doing recovery: scanned up to log sequence number 3029383094272
    22. InnoDB: Doing recovery: scanned up to log sequence number 3029388337152
    23. InnoDB: Doing recovery: scanned up to log sequence number 3029393580032
    24. InnoDB: Doing recovery: scanned up to log sequence number 3029398822912
    25. InnoDB: Doing recovery: scanned up to log sequence number 3029404065792
    26. InnoDB: Doing recovery: scanned up to log sequence number 3029409308672
    27. InnoDB: Doing recovery: scanned up to log sequence number 3029410197499
    28. InnoDB: Database page corruption on disk or a failed
    29. InnoDB: file read of page 261696.
    30. InnoDB: You may have to recover from a backup.
    31. 2022-09-30 15:46:13 7efd7d4b9720 InnoDB: Page dump in ascii and hex (16384 bytes):
    32. InnoDB: End of page dump
    33. 2022-09-30 15:46:13 7efd7d4b9720 InnoDB: uncompressed page, stored checksum in field1 2954782913, calculated checksums for field1: crc32 4105743401, innodb 3656047717, none 3735928559, stored checksum in field2 1636468951, calculated checksums for field2: crc32 4105743401, innodb 1782267872, none 3735928559, page LSN 705 1413703129, low 4 bytes of LSN at page end 626886507, page number (if stored to page already) 261696, space id (if created with >= MySQL-4.1.1 and stored already) 0
    34. InnoDB: Page may be an update undo log page
    35. InnoDB: Database page corruption on disk or a failed
    36. InnoDB: file read of page 261696.
    37. InnoDB: You may have to recover from a backup.
    38. InnoDB: It is also possible that your operating
    39. InnoDB: system has corrupted its own file cache
    40. InnoDB: and rebooting your computer removes the
    41. InnoDB: error.
    42. InnoDB: If the corrupt page is an index page
    43. InnoDB: you can also try to fix the corruption
    44. InnoDB: by dumping, dropping, and reimporting
    45. InnoDB: the corrupt table. You can use CHECK
    46. InnoDB: TABLE to scan your table for corruption.
    47. InnoDB: See also http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html
    48. InnoDB: about forcing recovery.
    49. InnoDB: Ending processing because of a corrupt database page.
    50. 2022-09-30 15:46:13 7efd7d4b9720 InnoDB: Assertion failure in thread 139627193931552 in file buf0buf.cc line 4295
    51. InnoDB: We intentionally generate a memory trap.
    52. InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
    53. InnoDB: If you get repeated assertion failures or crashes, even
    54. InnoDB: immediately after the mysqld startup, there may be
    55. InnoDB: corruption in the InnoDB tablespace. Please refer to
    56. InnoDB: http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html
    57. InnoDB: about forcing recovery.
    58. 07:46:13 UTC - mysqld got signal 6 ;
    59. This could be because you hit a bug. It is also possible that this binary
    60. or one of the libraries it was linked against is corrupt, improperly built,
    61. or misconfigured. This error can also be caused by malfunctioning hardware.
    62. We will try our best to scrape up some info that will hopefully help
    63. diagnose the problem, but since we have already crashed,
    64. something is definitely wrong and this may fail.
    65. key_buffer_size=8388608
    66. read_buffer_size=131072
    67. max_used_connections=0
    68. max_threads=2000
    69. thread_count=0
    70. connection_count=0
    71. It is possible that mysqld could use up to
    72. key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 801785 K bytes of memory
    73. Hope that's ok; if not, decrease some variables in the equation.
    74. Thread pointer: 0x0
    75. Attempting backtrace. You can use the following information to find out
    76. where mysqld died. If you see no messages after this, something went
    77. terribly wrong...
    78. stack_bottom = 0 thread_stack 0x40000
    79. /usr/sbin/mysqld(my_print_stacktrace+0x35)[0x8e5d85]
    80. /usr/sbin/mysqld(handle_fatal_signal+0x494)[0x6692b4]
    81. /lib64/libpthread.so.0(+0xf7e0)[0x7efd7d0a07e0]
    82. /lib64/libc.so.6(gsignal+0x35)[0x7efd7bb34495]
    83. /lib64/libc.so.6(abort+0x175)[0x7efd7bb35c75]
    84. /usr/sbin/mysqld[0xa4fc37]
    85. /usr/sbin/mysqld[0xa65454]
    86. /usr/sbin/mysqld[0xa6589b]
    87. /usr/sbin/mysqld[0xa53851]
    88. /usr/sbin/mysqld[0xa1ac5e]
    89. /usr/sbin/mysqld[0xa17204]
    90. /usr/sbin/mysqld[0xa17805]
    91. /usr/sbin/mysqld[0xa15059]
    92. /usr/sbin/mysqld[0x9ff480]
    93. /usr/sbin/mysqld[0x942b5d]
    94. /usr/sbin/mysqld(_Z24ha_initialize_handlertonP13st_plugin_int+0x48)[0x5ac828]
    95. /usr/sbin/mysqld[0x6f3171]
    96. /usr/sbin/mysqld(_Z11plugin_initPiPPci+0xbb6)[0x6f6fd6]
    97. /usr/sbin/mysqld[0x59ea28]
    98. /usr/sbin/mysqld(_Z11mysqld_mainiPPc+0x42d)[0x5a3cdd]
    99. /lib64/libc.so.6(__libc_start_main+0xfd)[0x7efd7bb20d1d]
    100. /usr/sbin/mysqld[0x595349]
    101. The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains
    102. information that should help you find out what is causing the crash.

    看日志的大体的意思是数据页的损坏。

    二、解决方案


    2.1 修改配置

     /etc/my.cnf 配置文件修改innodb 启动参数修改

    1. [mysqld]
    2. innodb_force_recovery = 1

    如果innodb_force_recovery = 1不生效,则可尝试2-6几个数字。

    然后重启mysql,重启成功。然后使用mysqldump或 pma 导出数据,执行修复操作等。修复完成后,把该参数注释掉,还原默认值0。

    配置文件的参数:innodb_force_recovery

    innodb_force_recovery影响整个InnoDB存储引擎的恢复状况。默认为0,表示当需要恢复时执行所有的恢复操作(即校验数据页/purge undo/insert buffer merge/rolling back&forward),当不能进行有效的恢复操作时,mysql有可能无法启动,并记录错误日志;

    innodb_force_recovery可以设置为1-6,大的数字包含前面所有数字的影响。当设置参数值大于0后,可以对表进行select,create,drop操作,但insert,update或者delete这类操作是不允许的。

    2.2导出数据脚本

    1. ### 数据库导出
    2. mysqldump -uroot -pwinner -A -B --force > ipvacloud20220929.sql

    注意:这里的数据一定要备份成功。然后删除原数据库中的数据。

    2.3 删除ib_logfile0、ib_logfile1、ibdata1

    备份MySQL数据目录下的ib_logfile0、ib_logfile1、ibdata1三个文件,然后将这三个文件删除,还删除了此数据库文件夹下的 .ibd结尾的文件。

    2.4 配置my.cnf

    将my.cnf中innodb_force_recovery = 1或2——6几个数字这行配置删除或者配置为innodb_force_recovery = 0 重启MySQL服务

    2.5 将数据导入MySQL数据库

     mysql -uroot -pwinner repair_azkaban   <  ipvacloud20220929.sql ;

    此种方法下要注意的问题:

    ib_logfile0、ib_logfile1、ibdata1这三个文件一定要先备份后删除;

    一定要确认原数据导出成功了,最后导入 成功 恢复了数据库。

     

  • 相关阅读:
    ubuntu外接显示器、不识别笔记本显示器
    【华为机试真题 JAVA】找出符合要求的字符串子串-100
    5 分钟完成 ZooKeeper 数据迁移
    科技型中小企业申报时间?
    ❤️ GitHub Copilot 读心术揭秘,Copilot 逆向工程笔记
    JSP页面中page指令contentPage/pageEncoding具有什么功能呢?
    快速了解常用的消息摘要算法,再也不用担心面试官的刨根问底
    Python:Web框架 Django之manage.py
    计算机考研数据库题库
    java基于ssm的农村留守儿童社会支持信息系统#毕业设计
  • 原文地址:https://blog.csdn.net/qq_35995514/article/details/127713901