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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrieve data from .bak file

Status
Not open for further replies.

namax

Technical User
May 22, 2011
19
PG
I have mistakenly deleted a table from the disk and I couldn't view the table again but the table has a .bak file.Is it possible for me to retrieve the records from the bak file.

Your advice will highly be appreciated and thank you in advance.
 
As Mike has implied above, a FP/VFP data table with a .BAK extension is merely a renamed .DBF file - its extension has been changed to save it as a Backup of the original file when a table Structure change was made.

If you change the .BAK file extension to .DBF (while not necessary, possibly changing the base filename as well) you should be able to USE the data table and utilize its data.

NOTE - if the table had Memo fields in it you might not be able to recover the data on those fields since the associated .FPT file might no longer match.

Good Luck,
JRB-Bldr
 
If there is a memo file, it will also be backed up as .TBK extension.

Help on Modify File says
Remember that Visual FoxPro creates a .bak file for the original table file and, if the table has a memo field, a .tbk copy of the original memo file. If you have any problems with MODIFY STRUCTURE, you can delete the new file or files and rename the .bak file and .tbk file, if any, to the original file extensions (.dbf and .fpt).

Bye, Olaf.
 
No backups of the indexes though (.cdx usually if the index is structural)

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Griff said:
No backups of the indexes though

Which means that if you: (i) modify a table structure by deleting or renaming a field that's present in an index tag; (ii) modify the tag to reflect that change; (iii) lose the DBF; and (iv) restore the DBF from a backup ...

...you're clobbered.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Also remember that the data that a .BAK file has will NOT contain the most recent data.

Its data will reflect the data as it was when the table structure was last made, nothing after that.

This might be a GOOD TIME (like "Closing the barn door after the horses have already run out") to consider putting into place a good systematic and regularly executed backup strategy so that these types of problems will have less impact on your operations.

Good Luck,
JRB-Bldr
 
BTW. You don't need to rename it to check it out - just enter "USE TABLE.BAK
 
Well, USE TABLE.BAK won't look for TABLE.TBK, if there is a memo file, it will still only look for TABLE.FPT. So you better rename.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top