Thread: Corrupt database

Corrupt database

From
Neil Fraser
Date:
One of our PostgreSQL databases has been corrupted somehow.  Whenever we
try to open it or access it the 'postmaster' task suddenly goes to 99%
CPU usage, it rapidly eats up all memory, then crashes our server.

This behaviour occurs when the database is opened in using Perl's DBI,
or when using psql or pg_dump or vacuumdb.  There is about a megabyte of
text contained in this database which I'd rather like to extract
somehow.  Our other PostgreSQL databases are running perfectly.

Any suggestions on how to recover my data?  I've browsed the PG data
files, but they appear to be binary, which I can't read.

PostgreSQL 7.1.1 on Linux 2.2.19

Thank you.
--
| Neil D. Fraser, Programmer & Wizard, neil@digitalroutes.co.uk
| Digital Routes, Inverness, Scotland, www.digitalroutes.co.uk


Re: Corrupt database

From
Martijn van Oosterhout
Date:
I've havn't done anything much with it in a while, but the link below may
help.

http://svana.org/kleptog/pgsql/pgfsck.html

On Wed, Oct 16, 2002 at 10:21:30AM +0100, Neil Fraser wrote:
> One of our PostgreSQL databases has been corrupted somehow.  Whenever we
> try to open it or access it the 'postmaster' task suddenly goes to 99%
> CPU usage, it rapidly eats up all memory, then crashes our server.
>
> This behaviour occurs when the database is opened in using Perl's DBI,
> or when using psql or pg_dump or vacuumdb.  There is about a megabyte of
> text contained in this database which I'd rather like to extract
> somehow.  Our other PostgreSQL databases are running perfectly.
>
> Any suggestions on how to recover my data?  I've browsed the PG data
> files, but they appear to be binary, which I can't read.
>
> PostgreSQL 7.1.1 on Linux 2.2.19
>
> Thank you.
> --
> | Neil D. Fraser, Programmer & Wizard, neil@digitalroutes.co.uk
> | Digital Routes, Inverness, Scotland, www.digitalroutes.co.uk
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>    (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.

Re: Corrupt database

From
Tom Lane
Date:
Neil Fraser <neil@digitalroutes.co.uk> writes:
> One of our PostgreSQL databases has been corrupted somehow.  Whenever we
> try to open it or access it the 'postmaster' task suddenly goes to 99%
> CPU usage, it rapidly eats up all memory, then crashes our server.

Hm.  Can you attach to the backend task with a debugger and get a stack
trace to show where it's going nuts?

            regards, tom lane