Corruption Detected Help 
Author Message
 Corruption Detected Help

Does anyone know how to check an index and the time, or before, you open it,
to determine if
it's corrupted or not?

We are having this problem a lot at work, due to network issues, and need to
write the code to
check if the index is corrupted, and if so, rebuild it...

Thanks in advance.
Michael J. Gregg



Mon, 08 Dec 2003 07:40:05 GMT  
 Corruption Detected Help
Hello Michael,

I have been losing sleep over this same problem for the past 3 weeks.
I have done some research and here are the results :

1. If your clipper application and running under Windows 95 , you have to
download and install a patch from Microsoft website. The file your looking
for is Vredrupd.exe

2. If your clipper database resides on a Novell server and your using Client
3.3  ... I think this could be the problem.
I say that because I started getting this error a short while after
upgrading from Client 3.1 with SP2 to Client 3.3

3. As for recreating an index, to the best of my knowledge this canNOT be
done while the file is in use by another.
You have to have Exclusive use of the file to recreate the index.

Check Novell's website for the phrase " clipper database corruption"

Hope this helps you. Please let me know if you get any additional
suggestions.

Good Luck
Sherif Z. Jacoub



Mon, 08 Dec 2003 10:34:09 GMT  
 Corruption Detected Help


Quote:
>Does anyone know how to check an index and the time, or before, you open
>it, to determine if it's corrupted or not?

Instead of using USE to open your database files and indexes, write a
function that does it for you. In this function, set up a local error
handler and use a BEGIN SEQUENCE / RECOVER USING block around the USE
statement and any SET INDEX TO statements. In the local error handler,
check for the corruption detected error class and force a recovery. In
the RECOVER USING / END SEQUENCE block, either set up the return value
to indicate that the indexes need to be created or possibly attempt to
recreate them right there.


Mon, 08 Dec 2003 21:56:11 GMT  
 Corruption Detected Help
This is what I was thinking about.

How do I go about manually corrupting a index for testing it?



Quote:


> >Does anyone know how to check an index and the time, or before, you open
> >it, to determine if it's corrupted or not?

> Instead of using USE to open your database files and indexes, write a
> function that does it for you. In this function, set up a local error
> handler and use a BEGIN SEQUENCE / RECOVER USING block around the USE
> statement and any SET INDEX TO statements. In the local error handler,
> check for the corruption detected error class and force a recovery. In
> the RECOVER USING / END SEQUENCE block, either set up the return value
> to indicate that the indexes need to be created or possibly attempt to
> recreate them right there.



Tue, 09 Dec 2003 08:07:29 GMT  
 Corruption Detected Help


Quote:
>How do I go about manually corrupting a index for testing it?

A variation on the following DOS command ought to do the trick:

    ECHO "This is a corrupted index file" > INDEX.CDX



Tue, 09 Dec 2003 09:36:15 GMT  
 Corruption Detected Help
On Wed, 20 Jun 2001 23:40:05 GMT, "Michael J. Gregg"

Quote:

>Does anyone know how to check an index and the time, or before, you open it,
>to determine if
>it's corrupted or not?

>We are having this problem a lot at work, due to network issues, and need to
>write the code to
>check if the index is corrupted, and if so, rebuild it...

>Thanks in advance.

Here's what I use. This is strictly time/date detection. If the index
is newer than the .dbf, it's probably ok. Not always, but enough of
the time to make it worthwhile without going into any in depth
checking.

Certainly, this catches most crashes during writes and modification to
tables outside the program. (with the indexes closed)

(You can get td2jul from my website in the julian functions)

*+
*+
*+    Static Function INDEX_BAD()
*+
*+    Called from ( goodntx.prg  )   1 - static function indx_make()
*+
*+
*+
static function INDEX_BAD( FIL )
// FIL is the dbf name without the extension

local IND    := FIL + myordbagext()
local retval := .f.

begin sequence

   FIL += '.dbf'

   if TD2JUL( FILETIME( IND ), FILEDATE( IND ) ) < ;
          TD2JUL( FILETIME( FIL ), FILEDATE( FIL ) )
      ferase( IND )
      SETFDATI( FIL )
      retval := .t.
      break
   endif

   if !file( IND )     // it was gone!
      retval := .t.    // rebuild it!
      break
   endif

end sequence

return retval

*************

Now, the compliment to this is in the closing routine. If you are the
last one out (I'll leave that as an exercise for you), you stamp all
of the .CDX's with the exit time, forcing them to all be newer than
the .DBF's.

if lastkey() = 27
 if VERIFY( 'Quit Program and Exit to DOS?', .t., 'Quit', 'Continue' )
    pop_msg( 'Closing all System Files', .f. )
    d_close_all()
    myshowtime()
    MYCOLOR( 1 )
    if d_alone() // only true if last one out...
       aCDXs   := directory( '*' + myordbagext() )
       aDBFs   := directory( '*.dbf' )
       nNumCdx := len( aCDXs )
       for x := 1 to nNumCdx
          thisdbf := rootname( aCDXs[ x, F_NAME ] ) + '.DBF'
          y       := ascan( aDBFs, { | d | d[ F_NAME ] == thisdbf } )
          if y > 0
             if aDBFs[ y, F_TIME ] <> aCDXs[ x, F_TIME ] .or. ;
                aDBFs[ y, F_DATE ] <> aCDXs[ x, F_DATE ]
                SETFDATI( aCDXs[ x, F_NAME ], aDBFs[ y, F_DATE ], ;
                                     aDBFs[ y, F_TIME ] )
             endif
          endif
       next
    endif
    ALLKEY( 1 )
    clear
    set cursor ( .t. )
    errorlevel( 0 )
    quit
 endif
endif

--

        Oasis WWW  http://www.the-oasis.net
         FTP Site  ftp://ftp.the-oasis.net
      Clipper FAQ  http://www.the-oasis.net/clipper.html
  Harbour Project  http://www.Harbour-Project.org

           Be as you would seem to be.



Sun, 14 Dec 2003 20:52:56 GMT  
 Corruption Detected Help
Hi,

I just fout this same Corruption Detected error on a quite large
project, using 50+ dbf files and 60+ NTX indexes.

This error appears only when dbcommit() is called after an update is
made with REPLACE.

This happens only on a particular dbf file, even after it has been
recreated and with fresh new indexes. All other files are OK.

Since this dbf file is the only one with a DESCENDING numeric index, I
startd to suspect this might be the problem...

Using 5.2e, exospace, standard libs only

Here is my code:



    READ
    if UPDATED()
       if RecLock(,"N?o possivel alterar os valores do stock")
             SET ORDER TO 0
             replace STOCKS->STK_ACTUAL with nActual,;
                     STOCKS->STK_MINIMO with nMinimo

             dbCommit()
             UNLOCK
             SET ORDER TO (saveOrder)
          endif
       endif
     endif

And this is the code that SELECTs the file, and creates the indexes if
needed:

FUNCTION SelectStk()
   IF SELECT("STOCKS") > 0
      SELECT STOCKS
      RETURN(.y.)
   endif

   SELECT 0

   if .not. NetUse("STOCKS",.n.)// .n. = shared
      return(.n.)
   endif
            // This compares date & time of DBF with Date & time of
NTX to
            // detect if they need to be recreated
   if .not. IndiceOk("STOCKS.DBF","STK_COD.NTX","STK_MIN.NTX","STK_FOR.NTX")
      if .not. NetUse("STOCKS",.y.) // .y. = exclusive
         SayBox("cannot create indexes. DBF file in use")
         return(.n.)
      endif
      index on COD_STOCK to STK_COD EVAL BarraL() EVERY 50
      index on STK_MINIMO to STK_MIN EVAL BarraL() EVERY 50 DESCENDING
      index on CODFORN   to STK_FOR EVAL BarraL() EVERY 50
      if .not. NetUse("STOCKS",.n.) // .n. = shared
         return(.n.)
      endif

   endif
   SET INDEX TO STK_COD, STK_MIN, STK_FOR
   SET ORDER TO 1
RETURN(.y.)

And this is the structure of the DBF file:

   "COD_STOCK ","C",5
   "STK_ACTUAL","N",14,3
   "STK_MINIMO","N",14,3
   "CODFORN   ","C",6

Does anyone have any clue about this ?

TIA

Antnio Vila-Ch?
Viana do Castelo
Portugal

On Wed, 20 Jun 2001 23:40:05 GMT, "Michael J. Gregg"

Quote:

>Does anyone know how to check an index and the time, or before, you
open it,
>to determine if
>it's corrupted or not?

>We are having this problem a lot at work, due to network issues, and
need to
>write the code to
>check if the index is corrupted, and if so, rebuild it...



Fri, 26 Dec 2003 07:14:30 GMT  
 Corruption Detected Help
Antonio ,

If you look in the Clipper guide error message section for this error, it
will tell you that using commands like :

Replace STOCKS->STK_ACTUAL  will cause this problem.

Clipper recommend that you select the area you want to replace in.

Hope this helps

Sherif Z. Jacoub



Thu, 01 Jan 2004 22:45:20 GMT  
 Corruption Detected Help
On Sun, 15 Jul 2001 10:45:20 -0400, "Sherif Jacoub"

Quote:

>Antonio ,

>If you look in the Clipper guide error message section for this error, it
>will tell you that using commands like :

>Replace STOCKS->STK_ACTUAL  will cause this problem.

>Clipper recommend that you select the area you want to replace in.

This statement is complete rubbish!  I have *never* heard of this
construct causing a problem & if it was true, it would break every app
I have coded for the last 15 years...

The actual guides text is:

 DBFNDX/1012  Corruption detected

     Explanation:  File corruption has been detected in the specified
     file.

     Action:  Make sure that the file type is correct for the
operation.
     For index files, make sure that the type of index matches the
driver
     being used (e.g., .ndx for DBFNDX).

--
Nick Ramsay
WitzEnd Computer Services



Fri, 02 Jan 2004 09:47:10 GMT  
 Corruption Detected Help
Thank you Nick,

I do agree with you regarding REPLACE FILE->FIELD with NEW_VALUE.

I have tons of statements like this on my code, and the problem
appears only on that particular portion of code.

I suspect it has something to do with the index having a DESCENDING
clause, because this is the only file on my project that has it.

Do you use DESCENDING on any of your indexes ? Anybody had this
problem before ?

Thanks a lot for your help.

Antnio Vila-Ch?
Viana do Castelo
Portugal



Sat, 03 Jan 2004 18:47:49 GMT  
 Corruption Detected Help

Quote:

>Do you use DESCENDING on any of your indexes ? Anybody had this
>problem before ?

A few years ago I had a problem with the descend() function in an
index expression. I'm not sure if it was the same problem or something
else, but there was something broken in that function. Somebody sent
me a descend.obj to replace the one in the library. Had no problems
since. It should be on the Oasis web site. If it's not ther, mail me
and I'll send you the file I had.

HTH

Peter Paul Jansen
email address: ppj at burdock dot com



Sat, 03 Jan 2004 22:32:08 GMT  
 Corruption Detected Help

Quote:

>Thank you Nick,

>I do agree with you regarding REPLACE FILE->FIELD with NEW_VALUE.

>I have tons of statements like this on my code, and the problem
>appears only on that particular portion of code.

>I suspect it has something to do with the index having a DESCENDING
>clause, because this is the only file on my project that has it.

>Do you use DESCENDING on any of your indexes ? Anybody had this
>problem before ?

No, I've never really had a need to use DESCENDING - maybe that's the
weakness...

--
Nick Ramsay
WitzEnd Computer Services



Sun, 04 Jan 2004 18:49:16 GMT  
 Corruption Detected Help

Quote:

> Hi,

> I just fout this same Corruption Detected error on a quite large
> project, using 50+ dbf files and 60+ NTX indexes.

> This error appears only when dbcommit() is called after an update is
> made with REPLACE.

> This happens only on a particular dbf file, even after it has been
> recreated and with fresh new indexes. All other files are OK.

> Since this dbf file is the only one with a DESCENDING numeric index, I
> startd to suspect this might be the problem...

> Using 5.2e, exospace, standard libs only

> Here is my code:



>     READ
>     if UPDATED()
>        if RecLock(,"N?o possivel alterar os valores do stock")
>              SET ORDER TO 0
>              replace STOCKS->STK_ACTUAL with nActual,;
>                      STOCKS->STK_MINIMO with nMinimo

>              dbCommit()
>              UNLOCK
>              SET ORDER TO (saveOrder)
>           endif
>        endif
>      endif

> And this is the code that SELECTs the file, and creates the indexes if
> needed:

> FUNCTION SelectStk()
>    IF SELECT("STOCKS") > 0
>       SELECT STOCKS
>       RETURN(.y.)
>    endif

>    SELECT 0

>    if .not. NetUse("STOCKS",.n.)// .n. = shared
>       return(.n.)
>    endif
>             // This compares date & time of DBF with Date & time of
> NTX to
>             // detect if they need to be recreated
>    if .not. IndiceOk("STOCKS.DBF","STK_COD.NTX","STK_MIN.NTX","STK_FOR.NTX")
>       if .not. NetUse("STOCKS",.y.) // .y. = exclusive
>          SayBox("cannot create indexes. DBF file in use")
>          return(.n.)
>       endif
>       index on COD_STOCK to STK_COD EVAL BarraL() EVERY 50
>       index on STK_MINIMO to STK_MIN EVAL BarraL() EVERY 50 DESCENDING
>       index on CODFORN   to STK_FOR EVAL BarraL() EVERY 50
>       if .not. NetUse("STOCKS",.n.) // .n. = shared
>          return(.n.)
>       endif

>    endif
>    SET INDEX TO STK_COD, STK_MIN, STK_FOR
>    SET ORDER TO 1
> RETURN(.y.)

> And this is the structure of the DBF file:

>    "COD_STOCK ","C",5
>    "STK_ACTUAL","N",14,3
>    "STK_MINIMO","N",14,3
>    "CODFORN   ","C",6

> Does anyone have any clue about this ?

> TIA

> Antnio Vila-Ch?
> Viana do Castelo
> Portugal

> On Wed, 20 Jun 2001 23:40:05 GMT, "Michael J. Gregg"

> >Does anyone know how to check an index and the time, or before, you
>  open it,
> >to determine if
> >it's corrupted or not?

> >We are having this problem a lot at work, due to network issues, and
>  need to
> >write the code to
> >check if the index is corrupted, and if so, rebuild it...

try this format:

STOCKS->STK_ACTUAL := nActual
STOCKS->STK_MINIMO := nMinimo

(d)iego



Tue, 06 Jan 2004 10:38:07 GMT  
 Corruption Detected Help
Thank you all for your help.

I found the problem. Between opening the file and replacing +
dbcommiting, a temporary index was created with a FOR clause, to show
data on a special order. So stupid I am, I used a LOCAL var on the FOR
clause.

Sorry to have botherd you all with this.

Antnio Vila-Ch?
Viana do Castelo
Portugal

Quote:


[snip]
> try this format:

> STOCKS->STK_ACTUAL := nActual
> STOCKS->STK_MINIMO := nMinimo

> (d)iego



Tue, 06 Jan 2004 20:41:34 GMT  
 
 [ 14 post ] 

 Relevant Pages 

1. Corruption Detected Help

2. Corruption detected......(Help!)

3. Urgent Help !! DBFNTX/1012 Corruption detected:

4. DBFNTX/1210 Corruption Detected - Please Help!

5. Help: DBFNTX/1210 Corruption detected

6. 1210 - Corruption Detected , please help me!!!!

7. DBFNTX / 1210 Corruption Detected .... Revisited

8. Corruption detected

9. DBF File - Corruption detected

10. CORRUPTION DETECTED ERROR

11. corruption detected ; cl53b-dbfcdx-bl3.3

12. Error : DBFNTX/1210 Corruption Detected

 

 
Powered by phpBB® Forum Software