data files corruption after server crash

From: Rytis <rytis(at)fotofabrikas(dot)lt>
To: pgsql-admin(at)postgresql(dot)org
Subject: data files corruption after server crash
Date: 2005-09-30 16:14:44
Message-ID: 433D6474.5040004@fotofabrikas.lt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hello,

Our server crashed and some of the pgsql/base files got corrupted. 2 out
of 10 databases now reject all connections with error:

psql: FATAL: "/var/db/pgsql/base/17236" is not a valid data directory
DETAIL: File "/var/db/pgsql/base/17236/PG_VERSION" is missing.

We have dump that's a week old... (I know dumps should be made more
often, suppose now they will be made each night:)
Our try to recover lost information was to create a database from the
old dump and then try to rewrite the files over with the ones left from
corrupted DB, but OID's have changed and after overwritting files we got
nothing. Now the structure remains ok, but when trying to browse the
overwritten tables we get error:

ERROR: invalid page header in block 0 of relation "cart_items"

After that we tried to do that vise versa :) to change 'pg_class' table (relname field) to reflect the change of file that got copied into db dir without changing the name of table file.
Then database said something like (don't have it already so error text goes from memory): ERROR relation not found, file does not exit in /base/19345/23456. If I understand correctly, the DB now can't find primary/foreight keys and relations to that table.

That's the whole situation, the question would be:

Is it possible to restore our lost data?
Is it possible to move files over like I've described, if not... can anyone help, or our data (and time in try to restore it) is just wasted?

P.S. sorry for mistakes if any English is not my mother tongue

Waiting for replies...

Browse pgsql-admin by date

  From Date Subject
Next Message Jeff Frost 2005-09-30 16:29:17 Re: archive_command
Previous Message Simon Riggs 2005-09-30 09:13:47 Re: archive_command