pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to find calculated CRC checksum of pg_controldata
3+ messages / 2 participants
[nested] [flat]

* How to find calculated CRC checksum of pg_controldata
@ 2014-04-03 13:58 Matthew Rantala <mjrantal@umn.edu>
  2014-04-09 16:44 ` Re: How to find calculated CRC checksum of pg_controldata Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Matthew Rantala @ 2014-04-03 13:58 UTC (permalink / raw)
  To: pgsql-admin

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.

-- 

Matthew J Rantala, GISP
Minnesota Geological Survey
University of Minnesota
2642 University Ave.
St. Paul, MN 55114-1057
(612) 627-4780 x206



-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: How to find calculated CRC checksum of pg_controldata
  2014-04-03 13:58 How to find calculated CRC checksum of pg_controldata Matthew Rantala <mjrantal@umn.edu>
@ 2014-04-09 16:44 ` Bruce Momjian <bruce@momjian.us>
  2014-04-10 17:38   ` Re: How to find calculated CRC checksum of pg_controldata Matthew Rantala <mjrantal@umn.edu>
  0 siblings, 1 reply; 3+ messages in thread

From: Bruce Momjian @ 2014-04-09 16:44 UTC (permalink / raw)
  To: Matthew Rantala <mjrantal@umn.edu>; +Cc: pgsql-admin

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  <bruce@momjian.us>        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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: How to find calculated CRC checksum of pg_controldata
  2014-04-03 13:58 How to find calculated CRC checksum of pg_controldata Matthew Rantala <mjrantal@umn.edu>
  2014-04-09 16:44 ` Re: How to find calculated CRC checksum of pg_controldata Bruce Momjian <bruce@momjian.us>
@ 2014-04-10 17:38   ` Matthew Rantala <mjrantal@umn.edu>
  0 siblings, 0 replies; 3+ messages in thread

From: Matthew Rantala @ 2014-04-10 17:38 UTC (permalink / raw)
  To: pgsql-admin

On 4/9/2014 11:44 AM, Bruce Momjian wrote:
> 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?
> Did you try pg_resetxlog?  That should set the checksum properly.
>
Thanks, Bruce

I think I actually tried that and while it did correct the checksum, I 
think it also closed/finalized the first log file 
(00000001000000000000001) and modified the checkpoint locations which 
wasn't going to work in my recovery. There may be a way to avoid that by 
passing the correct parameters, but I found digging into the source code 
easier.

Thanks again,

Matt

-- 

Matthew J Rantala, GISP
Minnesota Geological Survey
University of Minnesota
2642 University Ave.
St. Paul, MN 55114-1057
(612) 627-4780 x206



-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2014-04-10 17:38 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-04-03 13:58 How to find calculated CRC checksum of pg_controldata Matthew Rantala <mjrantal@umn.edu>
2014-04-09 16:44 ` Bruce Momjian <bruce@momjian.us>
2014-04-10 17:38   ` Matthew Rantala <mjrantal@umn.edu>

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