X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 7E450D1B4E6 for ; Fri, 31 Oct 2003 19:06:29 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 52395-04 for ; Fri, 31 Oct 2003 15:05:59 -0400 (AST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 0A67CD1B911 for ; Fri, 31 Oct 2003 15:05:57 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h9VJ5vN8006232; Fri, 31 Oct 2003 14:05:57 -0500 (EST) To: bristucc@sw.starentnetworks.com Cc: pgsql-admin@postgresql.org Subject: Re: dumping tables from badly damaged db In-reply-to: <20031031161943.GB24232@sw.starentnetworks.com> References: <20031031161943.GB24232@sw.starentnetworks.com> Comments: In-reply-to Brian Ristuccia message dated "Fri, 31 Oct 2003 11:19:43 -0500" Date: Fri, 31 Oct 2003 14:05:57 -0500 Message-ID: <6231.1067627157@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/417 X-Sequence-Number: 10978 Brian Ristuccia 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