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

Corrupt Indexes Paradox 7.0 2

Status
Not open for further replies.

bayBell

Programmer
Feb 26, 2001
11
US
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.
 
Hey Joe, can you give me a little insight into your weekend packing and verifying routine? Sound like something I ought to be doing as well.

Thanks,

Mac
Mac
:)
 
First, for those who may be interested. Some info from Corel.com on Index out of date error:

You do have a couple options here. Would you like to:
lighten your wallet?
or
give up a few brain Cells ?

The simpliest way is to get a copy of ChimmeySweep ( or
O & A's component for Delphi (
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.

These sites have some info on the subject, If you can understand REBLD32 from 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.
 
Thanks Joe. I don't suppose you'd share the TUtility verify function call syntax to save me reading through all the documentation ;-).

Thanks,

Mac
mailto:langley_mckelvy@cd4.co.harris.tx.us Mac
:)
 
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.

Declare these in the Uses method:

Uses TUtil32
TUInit(pTUSession CPTR ) CLONG
TUExit(TUSession CLONG ) CLONG
TUVerifyTable(hTUSession CLONG, tableName CPTR, driverType CPTR, rrorTable CPTR, password CPTR, options CLONG,errorLevel CPTR ) CLONG
endUses

Uses TUWWR32
TURegisterCallBackVerify(hWnd CLONG ) CLONG
TURegisterCallBackRebuild(hWnd CLONG ) CLONG
TUFreeCallBackVerify(hWnd CLONG ) CLONG
TUFreeCallBackRebuild(hWnd CLONG ) CLONG
TUWRebuildTbl(hTUSession CLONG, tableName CPTR, driverType CPTR, ackupTblName CPTR, keyViolTable CPTR, problemTblname CPTR,exampleTableName CPTR, hdrTableName CPTR, password CPTR,reserved CLONG ) CLONG
TUWNumRecs(fileName CPTR) CLONG
EndUses

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 Look in Tutility.hlp.

siOptions = 32
hTUSession = 0
liErrorLevel = 9999
TUInit(hTUSession)
hdlg = TURegisterCallbackVerify( windowHandle() )
iVerifyResult = TUVerifyTable(hTUSession, sTableName, "", sErrorTableName, sPassword, siOptions, liErrorLevel)
TUFreeCallbackVerify( hdlg )
TUExit(hTUSession)

Now, all you need is build a loop and supply the table names!

Good Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top