Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1drXOF-0002He-UF for pgsql-admin@arkaria.postgresql.org; Mon, 11 Sep 2017 22:41:16 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1drXOE-0002OY-VK for pgsql-admin@arkaria.postgresql.org; Mon, 11 Sep 2017 22:41:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1drXMQ-0007LY-Nt for pgsql-admin@postgresql.org; Mon, 11 Sep 2017 22:39:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1drXMN-0005gm-EY for pgsql-admin@postgresql.org; Mon, 11 Sep 2017 22:39:22 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v8BMdHnh008126; Mon, 11 Sep 2017 18:39:17 -0400 From: Tom Lane To: Richard Neill cc: pgsql-admin@postgresql.org Subject: Re: Fixing OID directory names after a fsck In-reply-to: <35287149-87d0-0763-6566-4aca468d0bad@richardneill.org> References: <7d85cf2a-db3b-b1dd-4646-396a8068a375@richardneill.org> <6898.1505167752@sss.pgh.pa.us> <35287149-87d0-0763-6566-4aca468d0bad@richardneill.org> Comments: In-reply-to Richard Neill message dated "Mon, 11 Sep 2017 23:27:08 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <8124.1505169557.1@sss.pgh.pa.us> Date: Mon, 11 Sep 2017 18:39:17 -0400 Message-ID: <8125.1505169557@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Richard Neill writes: >> This is unlikely to work unless you can also recover the pg_clog >> contents, which unfortunately might be pretty difficult to identify. > I can't find it. However, the failure was in the middle of the night, > and I think there's a pretty decent chance that postgres was idle at the > time - there was "probably" no transaction in progress, and the WAL > should have committed. That's all fine, but it only means that the right transactions would be marked committed in pg_clog. There's no very good reason to suppose that that marking has propagated back to the heap tuples in all cases. Actually though, I suspect a big chunk of your problem is that even tuples that are hinted committed will seem to be "in the future". You'd need to also recover pg_control, or at least reset it to something approximating the current XID counter, before stuff is likely to look sane. If you don't have pg_control, you might be able to dig around in the most recently modified tables and guess at the current XID by looking for the largest XIDs you can find. But, TBH, this is getting way past what you're likely to successfully pull off if you've never done it before. There are folks who do PG data recovery professionally [not me], and if your data is worth money to you, you'd be best off hiring someone who's done this before. If it's not, chalk this up to a learning experience, and set up a better backup system. regards, tom lane -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin