1

Konu: lütfen yardım dosyayı repair yapma

bu gün elektrikler kesildi ve proğram hata vermeye başladı
verdiği hata 'table ..\asilama.dbf 'has become corrupted. the table will need to be repaired before using again"

yardım kısmına baktim oda şunu diyor "Table "name" has become corrupted. The table will need to be repaired before using again. (Error 2091) 

Either the table record count does not match the actual records in the table, or the file size on the disk does not match the expected file size from the table header. Repair the table using an appropriate third-party repair utility for Visual FoxPro tables before opening the table again."


dosyayı  nasıl kurtarabilirim.

2

Re: lütfen yardım dosyayı repair yapma

sana bir uygulama dosyası gönderiyorum.
onunla onar.

3

Re: lütfen yardım dosyayı repair yapma

Aşağıdaki kod parçasıyla benzer hataları giderebilirisin.

Visual Fox Pro
set tablevalidate to 8 

use asilama in 0 exclusive
select asilama
pack



avrasya34 yazdı:

bu gün elektrikler kesildi ve proğram hata vermeye başladı
verdiği hata 'table ..\asilama.dbf 'has become corrupted. the table will need to be repaired before using again"

yardım kısmına baktim oda şunu diyor "Table "name" has become corrupted. The table will need to be repaired before using again. (Error 2091) 

Either the table record count does not match the actual records in the table, or the file size on the disk does not match the expected file size from the table header. Repair the table using an appropriate third-party repair utility for Visual FoxPro tables before opening the table again."


dosyayı  nasıl kurtarabilirim.

4

Re: lütfen yardım dosyayı repair yapma

ben vfp8 kullanıyorum altun arkadaşımızın verdi kodla çoğunlukla çözüyorum. ama bazan da düzelmiyor. o durumda pack den önce boş bir kayıt açıp siliyorum. ardından pack ve reindex yaptığımda düzeliyor.

5

Re: lütfen yardım dosyayı repair yapma

bazi durumlarda asagidaki sekildede kullanabilirsin bu durumda header kontrolu yapmadan table acilir

Visual Fox Pro
set tablevalidate to 0

6

Re: lütfen yardım dosyayı repair yapma

FoxFix veya Abri gibi programlar kullanabilirsin. Bunlar ücretli ancak inan bana müşterilerin çoğaldığında bunlar bir süre sonra kendilerini geri ödüyor.

7 Son düzenleyen, avrasya34 (19.02.2007 11:39:25)

Re: lütfen yardım dosyayı repair yapma

çok sağolun arkadaşlar ercan hocamın sayesinde sorunum haloldu.

8

Re: lütfen yardım dosyayı repair yapma

merhabalar,

visual foxpro 9.0 için foxfix.exe uygulamasının deneme sürümü dahi olsa arıyorum
yardımcı olursanız sevinirim.

iyi çalışmalar,

9

Re: lütfen yardım dosyayı repair yapma

ercan o uygulama dosyasını bana da gönderebilir misin?

10

Re: lütfen yardım dosyayı repair yapma

Merhaba ercan, o uygulama dosyasını bende alabilirim. Şimdiden teşekkürler

Uğur
-------------------------------------------------------------------------------------------------------------
Hayat bir bisiklete binmek gibidir. Pedalı çevirmeye devam ettiğiniz sürece düşmezsiniz. Claude Peppeer
Kusuru söylenmeyen adam, ayıbını hüner sanır.  Türk Atasözü

11

Re: lütfen yardım dosyayı repair yapma

Bugune kadar dosya repair icin foxprodan baskasina ihtiyacim olmadi:) fox.wikis.com'da da yayinladigim bir zamanlar fox4umda da olan bir kod var. O isinize yarabilir (not a table. repair diye ararsaniz bulursunuz sanirim).

12 Son düzenleyen, metin (13.06.2007 14:48:03)

Re: lütfen yardım dosyayı repair yapma

bu kod. ben bunu foxpro dos'ta da çalışacak şekilde uyarladım. ama bu o mu bilmiyorum. eğer bu o değilse foxpro dos'ta belli bir field'dan sonraki fieldları uçuruyor. dikkat!!!

çetin'e tekrar teşekkürler. bunun sayesinden dışardan başka .EXE'ler çalıştırmaktan kurtuldum...

Visual Fox Pro
*-------- metin in eki ------

lPARAMETERS xtable
  LOCAL xrepair
  xrepair=CREATEOBJECT("_repair")
  xrepair.repairheaderandmemo(m.xtable)
*-------- end metin in eki ------
 
Define CLASS _repair AS custom
*-- Reads given size of bytes at offsett specified by pos from a file opened
  Procedure readbytes
**************************************************************************
* ReadBytes(nHandle, nPos, nBytes[, lLR]) :
*   Reads given size of bytes at offsett specified by pos from a file opened
*   with low level functions (handle comes from that function)
* Parameters :
*   nHandle : (Numeric) Handle of a file to read bytes from
*   nPos    : (Numeric) File offsett to start reading
*   nBytes  : (Numeric) Byte count to read
*   (typically 1 for single byte, 2 for word and 4 for dword)
*   lLR     : (Logical)
*             if .T. left-to-right format used
*   (Default) if .F. right-to-left format used
*             (more likely to be used with low level)
* EXAMPLE :
* ReadBytes(handle,12,2)     - returns 62313 if bytes at offset 12 are ( 69 F3 )
* ReadBytes(handle,12,2,.T.) - returns 62313 if bytes at offset 12 are ( F3 69 )
* Remark :
* Doesn't save and restore current file pos. Caller should take care of it
**************************************************************************
  Lparameters tnHandle, tnPos, tnSize, tlLR
  Local lcString, lnRetValue,ix
  =fseek(tnHandle, tnPos,0) && Go to pos
  lcString = fread(tnHandle, tnSize) && Read tnSize bytes
  lnRetValue = 0
  For ix=0 to tnSize-1  && Convert to a number
    lnRetValue = lnRetValue + asc(substr(lcString,ix+1)) * ;
      iif(tlLR,256^(tnSize-1-ix),256^ix)
  Endfor
  Return int(lnRetValue)
Endproc
 
 
*-- Writes integer with given size of bytes at offsett specified by pos to a file opened
  Procedure writebytes
**************************************************************************
* WriteBytes
* Same as ReadBytes except writes to file
* 64 bits not available in this version
**************************************************************************
  Lparameters tnHandle, tnPos, tnSize, tnNumber, tlLR
  Local lcString, lnLowDword, lnHighDword,ix
  lcString=''
  If tlLR
    For ix=tnSize-1 to 0 step -1
      lcString=lcString+chr(tnNumber/256^ix%256)
    Endfor
  Else
    For ix=0 to tnSize-1
      lcString=lcString+chr(tnNumber/256^ix%256)
    Endfor
  Endif
  =fseek(tnHandle, tnPos,0) && Go to pos
  Return fwrite(tnHandle,lcString)
Endproc
 
 
*-- Repairs the header of a table and its memo. Frees the table removing backlink info and clears out has CDX flag.
  Procedure repairheaderandmemo
* RepairHeaderAndMemo
* Parameters
*    tcDBF          : Full path and name of dbf file to repair
* Remarks :
*   Table is freed (backlink info cleared if exists)
*   Has CDX flag is cleared && New copy has no CDX
  Lparameters tcDBF
  Local handle, lnFileSize, lnReccount, lnHeaderSize, lnRecordSize, ;
    lnCalculatedReccount, llHasMemo
  handle=fopen(tcDBF,12) && Opened readwrite
  lnFileSize = fseek(handle,0,2) && Get file size
* Read header info
  With this
    lnReccount   = .readbytes(handle, 4,4)
    lnHeaderSize = .readbytes(handle, 8,2)
    lnRecordSize = .readbytes(handle,10,2)
 
    lnCalculatedReccount = floor((lnFileSize-(lnHeaderSize+1))/lnRecordSize)
 
*-------- metin in müdahalesi ------
if lnCalculatedReccount<0
  lnCalculatedReccount=0
ENDIF   
*-------- end metin in müdahalesi ------
 
    If lnCalculatedReccount # lnReccount && If calculated # recorded fix it
      .writebytes(handle, 4,4,lnCalculatedReccount)
    Endif
    .writebytes(handle, 28,1,0) && Clear has CDX, has memo, isDBC flags
    =fseek(handle,lnHeaderSize-263 ,0)        && Go backlink info start
    =fwrite(handle,replicate(chr(0),263),263) && Clear backlink info and free table
    llHasMemo=file(forceext(tcDBF,'FPT'))
    If llHasMemo
      .RepairMemo(forceext(tcDBF,'FPT'))
      .writebytes(handle, 28,1,0x02) && Set has memo flag
    Endif
  Endwith
  =fclose(handle)
Endproc
 
*-- Fixes next block pointer, blocksize and filesize
  Procedure RepairMemo
* RepairMemo
* Simply fixes next block pointer, blocksize and filesize
  Lparameters tcMemoFilename
  Local handle, lnFileSize, lnNextBlockPointer, lnBlockSize, lnFirstBlock, lnCalculatedFileSize
 
  handle=fopen(tcMemoFilename,12) && Opened readwrite
  lnFileSize = fseek(handle,0,2) && Get file size
  With this
* Read header info
    lnNextBlockPointer = .readbytes(handle, 0,4,.T.) && Stored in left-to-right format
    lnBlockSize        = .readbytes(handle, 6,2,.T.) && Stored in left-to-right format
 
* Specific to me - no blocksize setting to something other than default 0x40
    If lnBlockSize # 0x40
      .writebytes(handle, 6,2,0x40,.T.)
      lnBlockSize=0x40
    Endif
*
    lnFirstBlock       = ceiling(512/lnBlockSize) && Possible min lnNextblockpointer
    lnCalculatedFileSize = lnNextBlockPointer*lnBlockSize
 
* Fix if needs repair
    If !(lnFileSize >= 512 ;
        and lnNextBlockPointer >= lnFirstBlock ;
        and lnCalculatedFileSize >= lnFileSize) && Memo needs repair
 
      lnNextBlockPointer = max(lnNextBlockPointer, lnFirstBlock)
      lnFileSize = lnNextBlockPointer * lnBlockSize
      .writebytes(handle, 0,4,lnNextBlockPointer,.T.) && Fix next block pointer
      =fchsize(handle, lnFileSize) && Fix filesize
    Endif
  Endwith
  =fclose(handle)
Endproc
Enddefine
Haksızlıklar karşısında susanlar, dilsiz şeytanlardır!
www.metinemre.com

13

Re: lütfen yardım dosyayı repair yapma

DOS ile VFP structurelar farkli. Bendekilerden bir tanesi bu (digerleri hep class):

Visual Fox Pro
* RepairHeaderAndMemo

* Parameters
*    tcDBF          : Full path and name of dbf file to repair
* Remarks :
*   Has CDX flag is cleared && New copy has no CDX
Lparameters tcDBF
Local handle, lnFileSize, lnReccount, lnHeaderSize, lnRecordSize, ;
  lnCalculatedReccount, llHasMemo
handle=fopen(tcDBF,12) && Opened readwrite
lnFileSize = fseek(handle,0,2) && Get file size
* Read header info
lnReccount   = ReadBytes(handle, 4,4)
lnHeaderSize = ReadBytes(handle, 8,2)
lnRecordSize = ReadBytes(handle,10,2)
 
lnCalculatedReccount = Iif(lnHeaderSize > lnFileSize,0,;
    floor((lnFileSize-lnHeaderSize)/lnRecordSize) )
If lnCalculatedReccount # lnReccount && If calculated # recorded fix it
  WriteBytes(handle, 4,4,lnCalculatedReccount)
Endif
WriteBytes(handle, 28,1,0) && Clear has CDX, has memo, isDBC flags
llHasMemo=file(forceext(tcDBF,'FPT'))
If llHasMemo
  RepairMemo(forceext(tcDBF,'FPT'))
  WriteBytes(handle, 28,1,0x02) && Set has memo flag
Endif
=fclose(handle)
 
Function RepairMemoHeader
Lparameters tcMemoFilename
Local handle, lnFileSize, lnNextBlockPointer, lnBlockSize, lnFirstBlock, lnCalculatedFileSize
 
handle=fopen(tcMemoFilename,12) && Opened readwrite
lnFileSize = fseek(handle,0,2) && Get file size
* Read header info
lnNextBlockPointer = ReadBytes(handle, 0,4,.T.) && Stored in left-to-right format
lnBlockSize        = ReadBytes(handle, 6,2,.T.) && Stored in left-to-right format
 
* Specific to me - no blocksize setting to something other than default 0x40
If lnBlockSize # 0x40
  WriteBytes(handle, 6,2,0x40,.T.)
  lnBlockSize=0x40
Endif
*
 
lnFirstBlock       = ceiling(512/lnBlockSize) && Possible min lnNextblockpointer
lnCalculatedFileSize = lnNextBlockPointer*lnBlockSize
 
* Fix if needs repair
If !(lnFileSize >= 512 ;
    and lnNextBlockPointer >= lnFirstBlock ;
    and lnCalculatedFileSize >= lnFileSize) && Memo needs repair
  lnNextBlockPointer = max(lnNextBlockPointer, lnFirstBlock)
  lnFileSize = lnNextBlockPointer * lnBlockSize
  .WriteBytes(handle, 0,4,lnNextBlockPointer,.T.) && Fix next block pointer
  =fchsize(handle, lnFileSize) && Fix filesize
Endif
=fclose(handle)
 
Function ReadBytes
Lparameters tnHandle, tnPos, tnSize, tlLR
Local lcString, lnRetValue,ix
=fseek(tnHandle, tnPos,0) && Go to pos
lcString = fread(tnHandle, tnSize) && Read tnSize bytes
lnRetValue = 0
For ix=0 to tnSize-1  && Convert to a number
  lnRetValue = lnRetValue + asc(substr(lcString,ix+1)) * ;
    iif(tlLR,256^(tnSize-1-ix),256^ix)
Endfor
Return int(lnRetValue)
 
Function WriteBytes
Lparameters tnHandle, tnPos, tnSize, tnNumber, tlLR
Local lcString, lnLowDword, lnHighDword,ix
lcString=''
If tlLR
  For ix=tnSize-1 to 0 step -1
    lcString=lcString+chr(tnNumber/256^ix%256)
  Endfor
Else
  For ix=0 to tnSize-1
    lcString=lcString+chr(tnNumber/256^ix%256)
  Endfor
Endif
=fseek(tnHandle, tnPos,0) && Go to pos
Return fwrite(tnHandle,lcString)

14

Re: lütfen yardım dosyayı repair yapma

Bu arada ReadBytes/WriteBytes VFPnin yeni bintoc() parametreleri ile kisalabilir.

15

Re: lütfen yardım dosyayı repair yapma

çetin vermiş olduğun o güzel kodda "RepairMemo" foksiyonu yok. gördermen mümkün mü?

16 Son düzenleyen, ercan (29.08.2007 16:19:56)

Re: lütfen yardım dosyayı repair yapma

http://www.cmstory.com/ adresinden  download dan ya da ana sayfadan "CM table Repair Utility"
uygulamasaını indirerek her türlü tablo ya da memo dosyalarındaki bozulmaları düzeltebilirsiniz.

17

Re: lütfen yardım dosyayı repair yapma

aydın yazdı:

kodda "RepairMemo" foksiyonu yok. gördermen mümkün mü?


Kodun aslı class. Sagdan soldan toplayıp yazarken adı yanlis olmuş. RepairMemoHeader o fonksiyon.