Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WXvcS-0008OE-IL for pgsql-admin@arkaria.postgresql.org; Wed, 09 Apr 2014 16:45:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WXvcS-000747-1v for pgsql-admin@arkaria.postgresql.org; Wed, 09 Apr 2014 16:45:00 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WXvcR-00072z-24 for pgsql-admin@postgresql.org; Wed, 09 Apr 2014 16:44:59 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WXvcO-00010v-MQ for pgsql-admin@postgresql.org; Wed, 09 Apr 2014 16:44:58 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1WXvcN-0005nQ-Ex; Wed, 09 Apr 2014 12:44:55 -0400 Date: Wed, 9 Apr 2014 12:44:55 -0400 From: Bruce Momjian To: Matthew Rantala Cc: pgsql-admin@postgresql.org Subject: Re: How to find calculated CRC checksum of pg_controldata Message-ID: <20140409164455.GC8686@momjian.us> References: <533D6902.9080300@umn.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <533D6902.9080300@umn.edu> User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -2.2 (--) 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 On Thu, Apr 3, 2014 at 08:58:26AM -0500, Matthew Rantala wrote: > Hello, > > Question: Is there a way to obtain the calculated CRC checksum for > pg_controldata from the command line? > > I'm asking this because we had our database get wiped out, and for a > variety of reasons, did not have a clean backup of the data > directory. I did, however, have a complete set of WAL files for the > database from the origin of the instance's life. I was able to use > these to restore the database into a new database that I engineered > look like a copy of the original by editing the pg_control file (and > first log file) by changing the Database system identifier and the > CRC checksum. > > Finding the correct CRC checksum, however, was a pain. I downloaded > the code and modified pg_controldata.exe so it would display the > file CRC and calculated checksums so I would know what the correct > value was. > > I'm in the process of documenting what I did and it would make the > whole process much easier if there is a way to determine the CRC > checksum without having to dig into the source code. I am currently > using 9.2.6. > > Thanks for any info, > > Matt, who was extremely lucky that I initiated WAL logging at the > very beginning. Did you try pg_resetxlog? That should set the checksum properly. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin