Re: Corrpupt Data File

From: Alex Derbes <acd(at)brillig(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Corrpupt Data File
Date: 2004-02-26 17:22:01
Message-ID: Pine.LNX.4.44.0402260909040.31950-100000@m1.brillig.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)brillig(dot)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(at)brillig(dot)org - acd(at)cwru(dot)edu
f720.920.1148 - c415.572.1669
http://www.brillig.org/~acd

01 1010 100

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Josh Berkus 2004-02-26 17:40:03 Re: Known issue with Reindex-based corruption?
Previous Message Tom Lane 2004-02-26 14:00:17 Re: Corrpupt Data File