Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j4n7D-0004Hk-W5 for pgsql-general@arkaria.postgresql.org; Thu, 20 Feb 2020 14:47:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j4n7B-0001bj-LN for pgsql-general@arkaria.postgresql.org; Thu, 20 Feb 2020 14:47:45 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j4n7B-0001bb-7d for pgsql-general@lists.postgresql.org; Thu, 20 Feb 2020 14:47:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j4n78-0006sB-Fq for pgsql-general@lists.postgresql.org; Thu, 20 Feb 2020 14:47:43 +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 01KElbR2006704; Thu, 20 Feb 2020 09:47:37 -0500 From: Tom Lane To: al cc: pgsql-general@lists.postgresql.org Subject: Re: Trying to restore a PostgreSQL-9.6 database from an old complete dump and/or a up-to-date just base directory and other rescued files In-reply-to: <2a83cbe8-952f-6623-1cf1-22e356d6288b@blogmail.cc> References: <2a83cbe8-952f-6623-1cf1-22e356d6288b@blogmail.cc> Comments: In-reply-to al message dated "Thu, 20 Feb 2020 10:54:54 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <6702.1582210057.1@sss.pgh.pa.us> Date: Thu, 20 Feb 2020 09:47:37 -0500 Message-ID: <6703.1582210057@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk al writes: > Hello. I'm trying to restore/rescue a database from some that I have: > * I have all the recent files in PGDATA/base > (/var/lib/postgresql/9.6/main/base/), but I have not the complete > /var/lib/postgresql/9.6/main/ > * I have all files from an old backup (and not much different) dump > that I restored in a new installation of PostgreSQL-9.6. > * I have a lot of rescued files from the hard drive (from ddrescue) > and I got thousand of files without a name (having a "#" and then a > number instead and in lost+found directory), so, for instance: > * I have the pg_class file > * I have the pg_clog directory with 0000 file > I have not: > * I have not the original content in pg_xlog directory (I have an > old one, maybe, if it didn't changed, it still being useful) Unfortunately, not having an up-to-date copy of the xlog info is practically fatal to your hopes of getting back consistent data. There are some Postgres support companies who specialize in data recovery; if this data is worth money to you, go hire a specialist. The chance of hacking your way to a usable fix without knowing exactly what you're doing is nil. (A specialist might not be successful either, of course.) regards, tom lane