What would cause Indexes to become corrupt. All is working fine, then sometimes Indexes become corrupt. Sometimes all is good, then on restarting Indexes are corrupt. HELP
In my humble experience it either comes from improper shutdown procedure (computer crashes) or somehow getting the wrong px file in a transfer. (I shuttle my files back and forth between a laptop and a pc - long story.
One way to deal with it is to delete all lck and pdox.usr files in the folder or try isolating just the db, mb and px files (copies) of the database in question in a separate file. If it doesn't work, delete the .px file and restore the data base. This from pretty primitive trial and error experience.
I encounter this problem about 4 - 5 times a year. There are no lck or pdox.user files in this folder. I don't jockey the files around. Sometimes it happens while working, no crash involved. I do correct it by deleting the PX files in all the tables and then restoring them. I also delete the VAL files. Is that neccesary? It is not always the same table, that is why I do all of them. It takes about 2 hours. Thanks for your help. I would really like to find the reason for this to be happening.
The most likely cause is not leaving Paradox properly. That is, your app crashed! This is more of a problem in a multi-user environment.
To guard against this potential problem, once a week, I run Tutility against all my tables, in addition, I “pack” all tables, too. I set up a couple jobs in my scheduler to take care of these over the weekend. I would just check the log file on Monday. I have not had a corrupted table for years.
You don’t have to delete .Val file, delete just the .px file.
Now if you are into some pains and sufferings. Here is what you need to automate this process.
You will need Tutil32.dll. You should have it in the Paradox program directory. This is the 32-bit version. For Pdox 7 (16-bit) and earlier version, use Tutil.dll.
For Pdox for DOS, use TUtility.exe with command line options. What I am about to descibe here does not apply to Pdox for DOS.
You need to know how make calls to Tutil32.dll functions.
You will need a “scheduler” if you want to check the tables unattended.
If you don’t have a scheduler, you need to write one. It’s not too hard, I wrote mine.
Here is how my program works.
I have a scheduler created in Paradox that I used to run jobs unattended.
In this scheduler, I have a job that runs at 1 am every Saturday to verify Paradox tables.
(You can run as often as you need. I have large… make that huge, tables that would take a long time to run. That’s why I only run it once a week.)
The program scans a directory to get a list of the table names and save them to a temp table.
The program scans through the temp table, get the table name and verify the table (function calls to Tutil32.dll).
The result of each table is saved to a log table.
On Monday, I scan the log table for any errors. If error does occur, I could send an e-mail to myself or even page me.
Although Tutil32.dll has the ability to repair a corrupted table, I have elected to perform this task manually.
Still want to do it the hard way?
There is not a whole lot of info on this subject for using with Paradox. However, if you are a Delphi programmer, there are many more options or components you can use to achieve the same result. I find tutil32d.zip works for me. I can’t remember where I’ve found it, you can do a search on the web.
web site. You are in good shape to create your own program. By the way, this site is in Swedish.
To Pack you table.
Again, I use my scheduler to accomplish this task.
I scan a directory for a list of all the table names and save them to a temp table.
I go down the list, get the table name, extract its original file size (use for comparision).
The codes:
….
If Not Tbl.Attach(mytable) Then
Error handler
EndIf
Try
Tbl.Compact() ;Here is the magic!
OnFail
Error handler
EndTry
…
I will get the new file size, along with its orignal file size, save the info to a log table.
That’s it. I created these programs about 3 years ago and they have been working smoothly ever since.
The original codes were created years ago, I can’t remember what they all mean anymore. I know, I know… should have commented them better.
The codes were tightenly intergrated into an application. I cannot give the application out, since it contains proprietary information belongs to my client.
However, in the spirit of sharing I have extracted the core codes that you will need.
If you know how to make calls to DLL, you should have no problem getting it to work.
In addition to Tutil32.dll, you will also need TUWWR32.DLL, it should be installed when you install Pdox.
In your codes, define sTableName to the table you want to verify. The result or error code is stored in iVerifyResult. To see what the error code means.
Download Tutility API and DLL from
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.