pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: bristucc@sw.starentnetworks.com
Cc: pgsql-admin@postgresql.org
Subject: Re: dumping tables from badly damaged db
Date: Fri, 31 Oct 2003 14:05:57 -0500
Message-ID: <6231.1067627157@sss.pgh.pa.us> (raw)
In-Reply-To: <20031031161943.GB24232@sw.starentnetworks.com>
References: <20031031161943.GB24232@sw.starentnetworks.com>

Brian Ristuccia <bristucc@sw.starentnetworks.com> writes:
> Recently I had a problem where a system crash scribbed on some directories,
> which landed a bunch of files, including a few of the system table files for
> one of my databases, in lost+found along with a zillion other files. 

Ugh.

> I might be able to find the file for this table/index in lost+found, but how
> do I know what name to give it in /var/lib/postgres/...?

I can't think of any reasonably simple way to identify the files by
content (this might be something to try to fix in future, but for now
you're stuck).  Best idea I can think of is to examine "od -c" dumps
and try to intuit which file is which.

> Currently, I can't connect to the database with the following error:
> psql: FATAL 1:  cannot open pg_class_relname_index: No such file or directory

You might be able to get past this by starting a standalone postgres
with the -P command-line option (ignore system indexes).  If so, try
"select relname, relfilenode from pg_class".  With luck that will give
you a list of which file name is needed for each table.  I'd not counsel
trying to do more than that in the standalone backend until you've
gotten at least the tables put back together.

You do not need to try very hard to recreate the indexes --- you can use
REINDEX to rebuild them.

Good luck!

			regards, tom lane



view thread (6+ messages)  latest in thread

Message-ID: <6231.1067627157@sss.pgh.pa.us>
Permalink:  ../6231.1067627157@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/6231.1067627157@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, bristucc@sw.starentnetworks.com
  Subject: Re: dumping tables from badly damaged db
  In-Reply-To: <6231.1067627157@sss.pgh.pa.us>
  References: <20031031161943.GB24232@sw.starentnetworks.com> <6231.1067627157@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox