ICode9

精准搜索请尝试: 精确搜索
首页 > 数据库> 文章详细

postgresql 错误:关系“global/1213”中的块0存在无效项

2022-08-31 14:01:19  阅读:295  来源: 互联网

标签:1213 damaged postgresql postgres global zero data pages


问题

Postgresql12 连接时提示 错误:关系“global/1213”中的块0存在无效项

解决方案


提示:此操作将销毁数据,即损坏页面上的所有行!但是,它允许您跳过错误,并从表中可能存在的任何未损坏的页面中检索行。


1.启动psql,查看是否启用了zero_damaged_pages

postgres=# show zero_damaged_pages;
 zero_damaged_pages
--------------------
 off
(1 行记录)

2.如果没有启用,则开启zero_damaged_pages

postgres=# SET zero_damaged_pages=on;
SET

开启后,再查询一下其状态

postgres=# show zero_damaged_pages;
 zero_damaged_pages
--------------------
 on
(1 行记录)

3.执行查询,数据库会自动开始清零操作

postgres=# SELECT DISTINCT datlastsysoid FROM pg_database;
警告:  关系 "global/1213" 中的块 0 无效的页;正在对页进行清零操作

 datlastsysoid
---------------
         13317
(1 行记录)

参考

zero_damaged_pages 官方解释

zero_damaged_pages (boolean)
Detection of a damaged page header normally causes PostgreSQL to report an error, aborting the current transaction. Setting zero_damaged_pages to on causes the system to instead report a warning, zero out the damaged page in memory, and continue processing. This behavior will destroy data, namely all the rows on the damaged page. However, it does allow you to get past the error and retrieve rows from any undamaged pages that might be present in the table. It is useful for recovering data if corruption has occurred due to a hardware or software error. You should generally not set this on until you have given up hope of recovering data from the damaged pages of a table. Zeroed-out pages are not forced to disk so it is recommended to recreate the table or the index before turning this parameter off again. The default setting is off, and it can only be changed by a superuser.

标签:1213,damaged,postgresql,postgres,global,zero,data,pages
来源: https://www.cnblogs.com/mayhot/p/16642855.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有