Re: How to deal with corrupted database?

From: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
To: "Ruslan A(dot) Bondar" <fsat(at)list(dot)ru>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: How to deal with corrupted database?
Date: 2011-11-09 13:04:47
Message-ID: 4EBA7A6F.50602@ringerc.id.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 11/09/2011 07:02 PM, Ruslan A. Bondar wrote:
> Hello all.
>
> This is a first time I receive such an issue.
> My database was corrupted some way.
Before you do ANYTHING else, make a copy of your database somewhere
safe. See:

http://wiki.postgresql.org/wiki/Corruption
> When I'm trying to access the database via psql I receive:
>
> root(at)udb:/etc/bacula# psql -U bacula
> psql: FATAL: could not read block 0 in file "base/16387/86057840": read only 0 of 8192 bytes
>
>
> So I want to drop it, and recover from backup. But when I'm trying to drop the database I see:
>
> postgres=# drop database bacula;
> ERROR: could not access status of transaction 15892843
> DETAIL: Could not open file "pg_subtrans/00F2": No such file or directory.
>
>
> Is there any way to recover the database to working state, or drop it?
>
*ONLY* once you've made a full backup copy, you may be able to set
zero_damaged_pages to get a usable dump.

Do you know what caused this? The missing files suggest it was probably
file system corruption - was there a disk failure? fsck run with errors?
Unexpected reboot on a RAID controller with a dead backup battery?

--
Craig Ringer

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Geoffrey Myers 2011-11-09 13:10:36 setting timezone
Previous Message Alexander Burbello 2011-11-09 11:28:37 Exp/Imp data with blobs