Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FILES DBF

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
Dear all :

I have been developing programs in Foxpro for several years, but I never had a problem with the DBFs that are open and the power shut off suddenly. When I try to reopen the file, I get a message like 'FILE IS NOT A DATABASE'. 2 times I lost 2 files with more than 3000 records.

Please help me what can I do to solve this problem.

Sincerely,

Luis
 
Sadly, there may not be a lot you can do - I assume the power shut off wasn't intentional?

If you can't prevent the power shut-offs, then any hope for a solution probably lies in changing the way disk caching is done on your PC. My first step would be to try disabling write-caching.

How to do that depends on
1) what OS you are running on
2) Whether the DBFS are on a local disk or across a network and if so, which? [sig][/sig]
 
Go get a good size Uninteruptable Power Supply (UPS) for your computer. [sig]<p>David W. Grewe<br><a href=mailto:Dave@internationalbid.net>Dave@internationalbid.net</a><br>ICQ VFP ActiveList #46145644[/sig]
 
I did see another idea elsewhere, but may involve too much rewriting:

Issue the FLUSH command after any updates

(or less global: issue the UNLOCK command)

You could write a prog (or Word Processor macro) to insert a line with &quot;FLUSH&quot; after every line that has &quot;REPLACE&quot;

[sig][/sig]
 
LCruzado,

YES! There IS something you can do to repair damaged .dbf and .fpt files. First off, there are some utilities that may do it. The old Norton Utilities program handled Fox 2.x dbf tables pretty well (except for memo files).

Or, if you'd rather do it yourself...
Get hold of a hex editor (freely downloadable) and go to this link:
That's where you'll see how dbf headers are laid out. Hopefully, the damage will be in the first few bytes and you'll be back in business in no time!

If you get that far, but then are hit with &quot;Memo file missing...&quot; error, you can 'unhinge' the memo file by replacing the byte in the dbf header that tells fox that there is a memo file. You'd lose your memo data that way, but at least the dbf will be open. If you must get data from the .fpt file - open it from a word processor and copy and paste as needed.

Hank Castello
[sig][/sig]
 
My first thought would be to see if you can open it in Excel or Import it into Excel. If you could do that you could fix it and then export it to DBF file again. Been a long time since I worked with Foxpro. I have forgotten exactly how this might work. Seems like I did it once though. [sig][/sig]
 
If you have a copy of the damaged file's structure, create a new file using it and append from the damaged file. This can work with &quot; Not a dbf&quot; message usually works if you get a &quot;Missing memo file&quot; message. Then, if there is an associated index, try reindexing. If this works it's ok. Hope this helps.
 
HI, how are you ?

I have a little program (fixfoxpo.exe) that repair the header of the database and always do it succefuly.

If you need it send me a mail to lopezhernan@marin.esc.edu.ar
 
there is a utility program that will repair your problem called &quot;DSALVAGE&quot;. It will repair a wide range of data problems including file headers and memo files. I have used it sucessfully on a number of occasions and it has always done an excellent job for me...
 
I have handled this problem all of last 10 years. It occurs only when you are adding records to the DBF. This happens because the last few records are not physically written on the table (they remain in buffer) whereas record counter in the file header is updated. The file size determined from the file header is higher than the physical file size.

The trick is to physically add some extra bytes to the bottom of the file in DOS mode so that the length of the file exceeds the length determined by the file header. These extra bytes will act as FILLER and compensate for the actually lost 3 or 4 records.

You should have a dummy file 'xyz' of length 20000 bytes containing nothing but spaces. If the name of the damaged file is 'DAMAGED.DBF', use the following DOS command to pad the extra bytes:

COPY DAMAGED.DBF/B + XYZ/B

This file is, now, ready for use in Foxpro. However, if it gives the same error again, it means the bytes added are not sufficient. You must perform the COPY again.

(ALTERNATIVELY, you should also have FOXPLUS installed on your machine. Such damaged files have no problems opening in Foxplus. Open a damaged file in Foxplus, create a copy with COPY TO...., throw away the original and rename the copy to original. However, this method works only with files which conform to Foxplus definitions and limits of number of records, number of fields, field types, etc.)

Finally, you should USE the file in FOXPRO and edit last 3 or 4 damaged record. Also, all INDEXes on this file have to be rebuilt.
 
THERE IS A LIBRARY: FOXFIX.PLB AND A ROUTINE CALLED FIXALL.PRG THAT SOLVES THE PROBLEM, DOWNLOAD IT SEARCHING IN LYCOS WITH THE KEY WORD FOXFIX.
 
I am using a very old foxpro application over the network. The application and the data is called from the NT server. I am a network admin and do not know anything about non-windows foxpro.
All of a sudden the user has an error message saying that database does not have an index or something like that. I think I have to reindex the database files. when I start the application, the reindex option is greyed out. There is a reindex.exe in the directory which does not do anything. what should I do.
 
you may even try to copy the broken file to a floppy and run scan disk on the floppy, sometimes this will fix the problem on a small file(you only lose a few records)
I HIGHLY RECOMMEND YOU COPY THE FILE TO FLOPPY TO DO THIS THOUGH!
 
To : LCRUZADO

I got the same problem you have, but i search the web
for a solution, try using &quot; Fix_DBF.prg, it will help
you a lot.. If you can'nt find it, pls. e-mail me, so
i can send it..
 
I have had this problem many, many times. The best solution for older Fox 2.x files is DSALVAGE. It is available from HalloGram software. (Go to The cost for the pro version is $245, and if you are in the need for system critical data repair, this is rock sold. The interface is a bit old, but it has worked for me 100% of the time, and I've been developing fox applications for over 10 years. Good luck!
 
We have had great success with RECOVER by abri ( It has even repaired memo files! It can also be called programmatically, either within your program to be proactive, or to check for errors from a list of databases. It can be run within FoxPro, or they have a stand-alone version I've used to walk a customer through repairs over the phone.
If you have recurring problems, you could even set it up to run nightly using a scheduler...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top