Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
>What is the correct way to pack tables. I open the database in exclusive mode. When i say pack tablename, I get an internal error, and Foxpro is closed. When I try and access my tables, I can't , cause the indexes are then screwed. And I have to remove them and add again. Not even a database validate and recover help.
>
>Thanx Stuart
In the index routines for my programs I always remove the index tags before the PACK command. The PACK command will remove the deleted records but then will also rebuild all the structural index tags. If you have any corrupt indexes, they will be rebuilt and still be corrupt. It has happened to me more times than I can count over the years. I always perform the following for my index routines:
USE customer IN 0 ALIAS a_cust EXCLUSIVE
SELECT a_cust
DELETE TAG ALL
PACK
-- Rebuild all index tags
-- Close file
At one of my clients they have 1.4 million records in a table that every couple of months somebody would nuke and have corrupted indexes. The previous programmer would just PACK them and the corrupt indexes still existed. I just added the DELETE TAG ALL line to the index program and fixed it and also cut the reindex program time in half since the indexes are not rebuilt twice, once by the PACK command and then again by the specific INDEX ON commands.
Hope this helps a little.
Jace
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement