Re: Corrpupt Data File - Mailing list pgsql-bugs

From Alex Derbes
Subject Re: Corrpupt Data File
Date
Msg-id Pine.LNX.4.44.0402260909040.31950-100000@m1.brillig.org
Whole thread Raw
In response to Re: Corrpupt Data File  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
for the annals of postgres maintenance I got my DB running by using DD to
copy the blocks before the corrupt block, then add block from /dev/zero,
then add the remaining blocks from the file.  I discovered the block size
by looking at he output of pg_filedump.  To find the offending file select
rel_filename from pg_class where relname = TABLE_NAME.

My original error was : "ERROR:  Invalid page header in block 57879 of
orders" -- thus the bad block is #57879

cp 309928249 orders.bak
dd bs=8192 count=57879 if=309928249 of=out
dd bs=8192 count=1 seek=57879 if=/dev/zero of=out
dd bs=8192 skip=57880 seek=57880 if=309928249 of=out
mv out 309928249

Many thanks to Tom for his quick reply & Good luck to all others.

Thanks,
-Alex

On Thu, 26 Feb 2004, Tom Lane wrote:

> Alex Derbes <acd@brillig.org> writes:
> > deleting the indexes from the table did not help.  Is there a tool or
> > method that that I could use to simply skip the bad data and at least
> > recover the good blocks?
>
> Just zero out the broken page, eg with dd from /dev/zero.  Note it
> might be a good idea to shut down the postmaster while you do so,
> else there could be a copy of that page in Postgres shared buffers,
> which'd mask your attempted fix.
>
>             regards, tom lane
>

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
acd@brillig.org - acd@cwru.edu
f720.920.1148 - c415.572.1669
http://www.brillig.org/~acd

01 1010 100

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Corrpupt Data File
Next
From: Josh Berkus
Date:
Subject: Re: Known issue with Reindex-based corruption?