Thursday, May 9, 2013

Visual Fox Pro Hell: fpt file missing or invalid (memo file corruption)

I know, its 2013 and nobody should be dealing with Visual Fox Pro 6.0 databases, but one of the clients I support has a legacy system that uses foxpro databases. We have an SSIS job that pulls data everyday from `foxpro` and it recently started failing with the error, `person.fpt is missing or invalid`, I initially thought it was a network issue but the frequency of the failure increased and one fine day it stopped working at all. Lesson - don't wait for it to break completely. Because some day it will. So I naturally started googling and that was a time travel back to the ancient kingdoms of the internet. Microsoft's resources didn't help much, and I had to deal with shareware, freeware software that promise `.dbf` and `.fpt` repair as soon as you pay, help forums with no answers and annoying browser addons etc. After trying a lot of demo software I thought may be its just the `.fpt` file that needs rebuilding. So going though the documentation I thought I'd make a copy of this database and see if it rebuilds `.fpt` file and fortunately, it worked!

USE "C:\repair\person.dbf"
? RECCOUNT()
COPY STRUCTURE TO "C:\repair\person_fixed.dbf"
USE "C:\repair\person_fixed.dbf"
APPEND FROM "C:\repair\person.dbf"
? RECCOUNT()
RENAME "C:\repair\person.dbf" TO "C:\repair\oldperson.dbf"
RENAME "C:\repair\person_fixed.dbf" to "C:\repair\person.dbf"
CLOSE DATABASES

If your issue is not solved by this, then you may have to buy one of those repair tools and fix your dbf/fpt files.

Some links that will help
http://support.microsoft.com/kb/94348
http://fox.wikis.com/wc.dll?Wiki~MemoFileMissingOrInvalid

2 comments:

  1. Wow, amazing blog layout! How long have you been blogging for? you make blogging look easy. The overall look of your website is fantastic, let alone the content!

    Mobile app development in Coimbatore
    Android app development in Coimbatore

    ReplyDelete