ERROR: invalid page header in block 13760 of relation base/16995/67484
or that,when doing your database dump:
pg_dump: sql command Failed
pg_dump: Error message from server: ERROR: invalid page header in block 11947 of relation base/16995/17062
pg_dump: The command was: COPY public.samaged_table (column1,column2,column3,...) TO stdout;
it is likely your Postgresql server has hardware issues or has crashed (or,the VM host,as in my case). If it’s the case,pg_dump / pg_dumpall will error and exit when seeing a corrupted block.
Unfortunately,it mean’s you’ll loose some data,so depending on what you have in your database,you may resort to some other methods.
Here is a quick way to fix it:
database=# SET zero_damaged_pages = on;
SET
database=# VACUUM FULL damaged_table;
WARNING: invalid page header in block 13748 of relation base/16995/67484; zeroing out page
WARNING: invalid page header in block 13749 of relation base/16995/67484; zeroing out page
WARNING: invalid page header in block 13757 of relation base/16995/67484; zeroing out page
WARNING: invalid page header in block 13758 of relation base/16995/67484; zeroing out page
WARNING: invalid page header in block 13759 of relation base/16995/67484; zeroing out page
WARNING: invalid page header in block 13760 of relation base/16995/67484; zeroing out page
WARNING: invalid page header in block 13762 of relation base/16995/67484; zeroing out page
WARNING: invalid page header in block 13782 of relation base/16995/67484; zeroing out page
(...)
WARNING: index "damaged_table_site_id" contains 14697831 row versions,but table contains 14709258 row versions
HINT: Rebuild the index with REINDEX.
WARNING: invalid page header in block 13762 of relation base/16995/67484; zeroing out page
WARNING: invalid page header in block 13816 of relation base/16995/67484; zeroing out page
WARNING: invalid page header in block 13817 of relation base/16995/67484; zeroing out page
WARNING: invalid page header in block 13818 of relation base/16995/67484; zeroing out page
(...)
WARNING: index "damaged_table_site_id" contains 14697498 row versions,but table contains 14709258 row versions
HINT: Rebuild the index with REINDEX.
VACUUM
database=# REINDEX TABLE damaged_table;
Do a database dump after that to make sure it’s no longer corrupted (pg_dump / pg_dumpall should no longer complain).
Referenced from:http://blog.wpkg.org/2012/04/30/error-invalid-page-header-in-block-13760-of-relation-base1699567484/
原文链接:https://www.f2er.com/postgresql/195660.html