Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Memo Field corruotion
Wed, Nov 11 2009 11:42 AMPermanent Link

Jeff N.
I have a table at 1 site (that we know of so far) that is giving me a major headache.  The
table has a memo field in it that appears to be heavily corrupted.  I have ran a repair
and optimization on the table and nothing gives.  The Memo field in some places is over
100 mb and there are about 40-50 of these corrupt records out of about 9000 total records.
This is just a notes field that usually has less than 100 bytes in it.  I exported one of
the records Memo field to a text file and opened it with NotePad++ and it shows a B then
thousands of Null characters.  I have tried to set the Memo field to Null where the Length
of the field is less than 3  but every time i run the query i get an Out of Memory error.
If there are any valid characters in the field it will return a count with those, which
is usually 1, and it does not count the null characters.

The records are from 2004, so i am not sure what version of the engine was used to create
these records but we are currently using 4.26 build 3 with d2007.  The blb file is 1.4 gb
and the .dat 2.58 mb.    

Any help or ideas would be greatly appreciated.  Thanks
Wed, Nov 11 2009 1:24 PMPermanent Link

Jeff N.
Never mind, I figured out a way to fix it without just deleting the problematic records.
I saved the Notes field to a Memory Stream and nulled it if the size of the stream is
greater than 1000.  This is probably a pretty dirty way of doing it and I imagine there is
a better way, so any other ideas would still be appreciated.  Here is the code i used to
fix the problem:

procedure TForm1.Button1Click(Sender: TObject);
Var
 I: Integer;
 S: TMemoryStream;
begin
 Tbl.First;
 I:=1;
 P.Max:= Tbl.RecordCount;
 while Not Tbl.Eof do
   Begin
     S:= TMemoryStream.Create;
     Label1.Caption:= IntToStr(I);
     P.Position:= I;
     Application.ProcessMessages;
     Try
       try
         TblNotes.SaveToStream(S);
         if S.Size > 1000 then
           Begin
             Tbl.Edit;
             TblNotes.AsString:= '';
             Tbl.Post;
           End;
       Except on E: Exception Do
         Begin
           Tbl.Cancel;
           ShowMessage(E.Message);
           Exit;
         End;
       end;
     Finally
       S.Free;
       Tbl.Next;
       Inc(I);
     End;
   End;
end;
Fri, Nov 13 2009 12:48 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jeff,

<< Never mind, I figured out a way to fix it without just deleting the
problematic records.  I saved the Notes field to a Memory Stream and nulled
it if the size of the stream is greater than 1000.  This is probably a
pretty dirty way of doing it and I imagine there is a better way, so any
other ideas would still be appreciated.  Here is the code i used to fix the
problem: >>

Did another repair work cleanly on the table after you did this ?  In the
future, if you encounter corruption like this, just send me the table(s) and
I'll fix them for you (support@elevatesoft.com).

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Nov 23 2009 5:28 PMPermanent Link

Jeff N.
Tim,

Sorry I have been at a trade show for about a week.

<Did another repair work cleanly on the table after you did this ?  In the
future, if you encounter corruption like this, just send me the table(s) and
I'll fix them for you (support@elevatesoft.com).>

After i ran the procedure above i ran a repair and another optimize through the table just
to be sure and everything came back good.  The table appears to be good.  The records
where from like 2004 so i think we ended up just deleting them at the site itself, i just
wanted to make sure we had something in place to resolve the issue automatically in case
we ran into it again in the future.
Mon, Nov 23 2009 6:09 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jeff,

<< After i ran the procedure above i ran a repair and another optimize
through the table just to be sure and everything came back good.  The table
appears to be good.  The records where from like 2004 so i think we ended up
just deleting them at the site itself, i just wanted to make sure we had
something in place to resolve the issue automatically in case we ran into it
again in the future. >>

In this case, yes, it will work.  However, there are no guarantees with file
system corruption, so while it may work on this specific instance, other
times it may not.  Just a word of warning. Wink

However, I'm very glad that you were able to resolve the issue and get
things back in order.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image