Fix corrupt pg_toast table?
am 30.07.2009 23:48:08 von Michael Clark--00151750e8b65f351f046ff342c6
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Hello everyone.
Sorry if this has been covered already, I haven't had any luck searching and
finding a solution.
I have a database which appears to have some corruption in a toast value.
When I select a certain table, I get the following error:
ERROR: invalid page header in block 984 of relation "pg_toast_17341_index"
I am new enough to PG that I am having some troubles navigating around the
system tables and being able to do anything useful.
This error seems to be preventing a vacuum, reindex, and PGCOPY from going
through on the database.
I wrote a little script to fetch this table row by row until I hit an error,
and I think this has narrowed it down to a specific row, although trying to
fetch a row beyond this also gave this error (I am hoping that is a side
effect of the problem and that not the rest of the table is lost).
What is the best course of action to try and fix this and recover the data?
I am not concerned with recovering the particular row that appears to be
having problems, but the rest of the data in the table is important.
Thanks a lot for any help on this,
Michael.
--00151750e8b65f351f046ff342c6
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Hello everyone.
ad any luck searching and finding a solution.
ve a database which appears to have some corruption in a toast value.
r:
oast_17341_index"
I am having some troubles navigating around the system tables and being abl=
e to do anything useful.
d PGCOPY from going through on the database.
te a little script to fetch this table row by row until I hit an error, and=
I think this has narrowed it down to a specific row, although trying to fe=
tch a row beyond this also gave this error (I am hoping that is a side effe=
ct of the problem and that not the rest of the table is lost).
nd recover the data? =A0I am not concerned with recovering the particular r=
ow that appears to be having problems, but the rest of the data in the tabl=
e is important.
div>
--00151750e8b65f351f046ff342c6--
Re: Fix corrupt pg_toast table?
am 30.07.2009 23:59:08 von Tom LaneMichael Clark
> I have a database which appears to have some corruption in a toast value.
> When I select a certain table, I get the following error:
> ERROR: invalid page header in block 984 of relation "pg_toast_17341_index"
If it's only that index that has gotten damaged, REINDEX will fix it, eg
reindex index pg_toast.pg_toast_17341_index;
The bigger concern is whether there is other damage. Have you had any
system crashes, indications of flaky hardware, etc on that machine?
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
Re: Fix corrupt pg_toast table?
am 31.07.2009 21:01:16 von Michael Clark--0015175cb0587c7e7e0470050ba2
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Hello again.
I have an update, hoping someone can steer me in the right direction here.
After receiving the "could not access transaction" error mentioned in my
previous email I did some more digging and found that people have had
success resolving this issue using pg_resetxlog.
I gave this a try, first without specifying any options, which did not
resolve anything (it did not give an error on the command line). I then
read up on the command and passed a value for every swtich to set new
values, and again this had no effect. It did not give an error on the
command line, but trying to reset the index gives the same error. The
response I get at the command line after running the pg_resetxlog command
is: Transaction log reset
Here is the error I get when trying to reset this particular index:
2009-07-31 12:58:07.503 EDT [Test] - ERROR: could not access status of
transaction 3839923882
2009-07-31 12:58:07.503 EDT [Test] - DETAIL: Could not open file
"pg_clog/0E4E": No such file or directory.
2009-07-31 12:58:07.503 EDT [Test] - STATEMENT: reindex index
pg_toast.pg_toast_17431_index;
Here is the final pg_resetxlog command I tried to resolve the issue:
pg_resetxlog -f -x 0x100000 -m 0x10000 -o 0x10000 -l 0x1,0x1,0xCD ./
Here are the filenames for the files in the various directories that led me
to these switch values, as per the docs on pg_resetxlog:
-x switch - pg_clog folder had 1 file named: 0000
-m switch - pg_multixact/offsets had 1 file named: 0000
-o switch - pg_multixact/members had 1 file named: 0000
-l swtich - pg_xlog had 7 files, the one with the biggest named is:
0000000100000000000000CC
After running the pg_resetxlog command above I get the exact same error
about pg_clog/0E4E missing.
Does anyone have any other ideas about how to solve this?
Thanks,
Michael.
On Thu, Jul 30, 2009 at 6:08 PM, Michael Clark
> Thanks for the reply!
> On Thu, Jul 30, 2009 at 5:59 PM, Tom Lane
>
>> Michael Clark
>> > I have a database which appears to have some corruption in a toast
>> value.
>>
>> > When I select a certain table, I get the following error:
>> > ERROR: invalid page header in block 984 of relation
>> "pg_toast_17341_index"
>>
>> If it's only that index that has gotten damaged, REINDEX will fix it, eg
>> reindex index pg_toast.pg_toast_17341_index;
>>
>
>
> I tried this, and might have exposed another issue.
> Now I am getting:
> ERROR: could not access status of transaction 3839923882
> DETAIL: could not open file "pg_clog/0E4E": No such file or directory.
>
> I checked the pg_clog folder, and there is only a 0000 file.
>
> Any ideas on this one?
>
>
>> The bigger concern is whether there is other damage. Have you had any
>> system crashes, indications of flaky hardware, etc on that machine?
>>
>
> This happened on a customer machine which I have not had a chance to
> investigate. I have copied the PGDATA folder to one of our systems to
> diagnose.
>
> Thanks again,
> Michael.
>
>
--0015175cb0587c7e7e0470050ba2
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
can steer me in the right direction here.
eceiving the "could not access transaction" error mentioned in my=
previous email I did some more digging and found that people have had succ=
ess resolving this issue using pg_resetxlog.
, which did not resolve anything (it did not give an error on the command l=
ine). =A0I then read up on the command and passed a value for every swtich =
to set new values, and again this had no effect. =A0It did not give an erro=
r on the command line, but trying to reset the index gives the same error. =
=A0The response I get at the command line after running the pg_resetxlog co=
mmand is: Transaction log reset
cular index:
t access status of transaction 3839923882
EDT [Test] - DETAIL: Could not open file "pg_clog/0E4E": No such=
file or directory.
..pg_toast_17431_index;
log command I tried to resolve the issue:
0000 -m 0x10000 -o 0x10000 -l 0x1,0x1,0xCD ./
ectories that led me to these switch values, as per the docs on pg_resetxlo=
g:
-m switch - pg_multixact/offsets had 1 file named: 0000
- pg_multixact/members had 1 file named: 0000
g had 7 files, the one with the biggest named is: 0000000100000000000000CC<=
/div>
bove I get the exact same error about pg_clog/0E4E missing.
<=
/div>
<=
div class=3D"gmail_quote">On Thu, Jul 30, 2009 at 6:08 PM, Michael Clark
pan dir=3D"ltr"><codingninja@gm=
ail.com> wrote:
x #ccc solid;padding-left:1ex;">Thanks for the reply!
"gmail_quote">
span dir=3D"ltr"><
>tgl@sss.pgh.pa.us> wrote:
x #ccc solid;padding-left:1ex">
> I have a database which appears to have some corruption in a toast val=
ue.
> When I select a certain table, I get the following error:
> ERROR: invalid page header in block 984 of relation "pg_toast_173=
41_index"
it, eg
=A0 =A0 =A0 =A0reindex index pg_toast.pg_toast_17341_index;
ht have exposed another issue.
could not access status of transaction 3839923882
not open file "pg_clog/0E4E": No such file or directory.
file.
The bigger concern is whether there is other damage. =A0Have you had any
>
system crashes, indications of flaky hardware, etc on that machine?
which I have not had a chance to investigate. =A0I have copied the PGDATA f=
older to one of our systems to diagnose.
ain,
--0015175cb0587c7e7e0470050ba2--