db crash after power crash - Mailing list pgsql-general

From Anton Maksimenkov
Subject db crash after power crash
Date
Msg-id 8cac8dd0605281019n1b46ffefmd5ef80f999d237a3@mail.gmail.com
Whole thread Raw
Responses Re: db crash after power crash  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hi.

Some hours ago there was a power failure with my test machine while
active inserting data. After power back the OS done some "fsck", clean
some files (related to postgres working directory). Then I connect to
my DB and see this:

billing=# \d
ERROR:  index "pg_attribute_relid_attnum_index" is not a btree
billing=# reindex index pg_attribute_relid_attnum_index;
ERROR:  catalog is missing 1 attribute(s) for relid 2678

I searched through archives and tried to do some:

# reindexdb  -s -U root -d billing
Password:
reindexdb: reindexing of system catalogs failed: ERROR:  index
"pg_attribute_relid_attnum_index" is not a btree
# reindexdb  -U root -d billing
Password:
reindexdb: reindexing of database "billing" failed: ERROR:  index
"pg_attribute_relid_attnum_index" is not a btree

as you can see, without success. And so with vacuumdb.

That all was on my test (learning) environment... But this may occur
on production machine (who knows, anything may happens) and I want to
know how to play with such situations (or workaround them). My only
idea - to get the last 'pg_dump' file, drop database and restore it
from that file... but it is ugly idea because many recent data will be
lost. Is there other ways?

--
engineer

pgsql-general by date:

Previous
From: "Jorge Godoy"
Date:
Subject: Re: postgres 7 and eastern language
Next
From: Tom Lane
Date:
Subject: Re: db crash after power crash