Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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.


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

01 1010 100

In response to

pgsql-bugs by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group