Data reliability enhancements in Visual FoxPro 8.0 (814131)
The information in this article applies to:
- Microsoft Visual FoxPro 8.0
SUMMARYThis article lists data reliability enhancements that are
introduced in Visual FoxPro 8.0. The following is a list of enhancements that
are intended to prevent possible table corruption when tables are updated:
- Integrity checks when table is opened.
- Integrity checks when data is inserted or
appended.
- Trapping table operations that cause the table to exceed
the 2 gigabytes (GB) maximum file size.
MORE INFORMATIONDetection of header record count corruptionIn earlier versions of Visual FoxPro, records that are added in
transactions may be lost if the table is corrupted in such a way that the table
header record count does not match the number of records in the physical table
file. Visual FoxPro 8.0 adds a mechanism to test for this condition when the
table is opened by using the use command or at the begin transaction and end transaction commands. Because this validation requires locking the table
header, you may see a decrease in performance in multi-user scenarios where
file contention is high. This behavior is configurable, and the default is to
check at use, at begin transaction, and at end transaction. When this corruption is detected at use, you may
receive error message 2091: Table "name" has become
corrupted. The table will need to be repaired before you use it
again. You may receive this error message when you open tables in
Visual FoxPro 8.0 that, in earlier versions, open without error. When
this corruption is detected at begin transaction or end transaction, you may
receive error message 2065: Table "name" has a file
length / record count inconsistency that will not allow this transaction to be
committed. Please open the table exclusively and PACK it. You may
receive this error message when you add records to tables in Visual FoxPro 8.0
that, in earlier versions, allow records to be added without
error. You can set this behavior with the set tablevalidate command. set tablevalidate does not have repair functionality; it performs only integrity
checks as specified by nLevel. The syntax is set tablevalidate to nLevel where nLevel is one of the folllowing values: nLevel | Description | 0 | Does not perform table validation. | 1 | Validate record count when opening a table. | 2 | Validate record count when appending or inserting
records and writing them to disk. | 3 | Validate as described by nLevel=1 and nLevel=2
(default). |
To repair a table that might have this type of corruption,
run the following commands:
- set tablevalidate to 0
- use <tablename> exclusive
- lcColumnName = Substr(Sys(2015),1,10)
- alter table <tablename>
- add column (lcColumnName) c(1)
- alter table <tablename>
- drop column (lcColumnName)
- use set tablevalidate to 3
Important Any records whose physical record number is greater than the
header record count are removed when you execute this code. Also, back up your
table files before you perform any table structure manipulation. Be sure to
back up your table files (.dbf, .fpt, and .cdx) before you follow these steps.
- To copy the table to another table, use the copy
to command. (See Note after next point.)
- To remove all records from the original table, use zap, then use append from to copy all the records from the copied table back to the
original table.
- Note In the case of copy to or pack, you lose all records where the physical record number exceeds
the header record count.
Error message when table size exceeds 2 GB A problem occurs when an insert or an append operation causes a table (or .dbf) file to exceed the 2-GB
maximum file size. The problem causes the following error:
REFERENCES
For more information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
264867
Possible causes of data corruption in Visual FoxPro
293638 BUG: Header corruption causes END TRANSACTION to discard appended records
Modification Type: | Minor | Last Reviewed: | 9/8/2005 |
---|
Keywords: | kbDatabase kbProgramming kbinfo KB814131 kbAudDeveloper kbAudITPRO |
---|
|