|
Given that this seems problem has occurred a number of times for a
number I've written a small step by step procedure to address this
issue. Is there any other comments you which to add. I was thinking
that this should be added to the FAQ / troubleshooting in the docs. How to repair corrupted data due to "ERROR: invalid page header in block X of relation "Y": CAUTION this will permanently remove the data defined in the bad block 1. To identify which file(s) the relation is in: 1. <THE SELECT STATEMENTS TO COLLECT THIS DATA> I can't remember how I did it, but will keep hunting for my notes :) 2. so the file(s) are $PGDATA/<databaseDIR>/<relFile>.* The * is any number which is defined below 2. To calculate the * value: 1. SELECT <block> / 131072 AS filenum, <block> % 131072 AS blocknum; filenum | blocknum -----------+---------------- <filenum> | <blocknum> 1. 131072 comes from "each database file is 1G, or 131072 * 8k blocks" 2. The block size is determined when compiling postgres 3. Use "SHOW block_size in the database or use pg_controldata from the shell." to confirm this. The default is 8k. 3. Now you need to re-zero this block using the following command: 1. dd bs=8k seek=<blocknum> conv=notrunc count=1 if=/dev/zero of=$PGDATA/base/<databaseDIR>/<relFile>.<filenum> 1. Before you do this it is best to backup the block: "dd bs=8k skip=<blocknum> count=1 if=/path/file | hd" See this post: http://archives.postgresql.org/pgsql-general/2006-03/msg00002.php Your thoughts / comments... Cheers Noel Michael Fuhr wrote: On Thu, Mar 09, 2006 at 12:37:52PM +1100, Noel Faux wrote: |
begin:vcard fn:Noel Faux n:Faux;Noel org:Monash University;Biochemistry and Molecular Biology adr:;;;Clayton;Vic;3800;Australia email;internet:[EMAIL PROTECTED] tel;work:+61 03 9905 1418 url:http://vbc.med.monash.edu.au/~fauxn version:2.1 end:vcard
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly
