After opening a DBC I issue:

VALIDATE DATABASE RECOVER

I got the message:

Tag not found (structural CDX). Do you want eliminate it or cancel
validation?

I realize that the father table primary key and a sister table CDX are lost.

How I can by code reindex these tables and rebuild the proper relations and
IR ?

Thanks.

Alejandro Fernandez

Re: Validating a DBC by Olaf

Olaf
Tue Jun 17 23:32:17 CDT 2008

> I realize that the father table primary key and a sister table CDX are lost.
>
> How I can by code reindex these tables and rebuild the proper relations and
> IR ?

The missing CDX is recognized, as the index is mentioned within
the DBC data. DBCs have records for indexes ObjectType=Index,
Objectname=<<index Tag name>>, but the index expression is not
stored.

If you dont have a backup of the cdx the best you can do is

USE theTable IN 0 EXCLUSIVE
Now, when prompted, that the CDX is missing click "ignore"
DELETE TAG ALL
And now you can recreate the indexes from scratch.

What you can query from the DBC is, what index tag names existed:

cYourDBC= "C:\data\yourdbc.dbc"
Select Indexes.ObjectName As Tagname, Indexes.Property, ;
Tables.ObjectName as Tablename From (cYourDBC) as Indexes;
Left join (cYourDBC) As Tables On Indexes.ParentID = Tables.ObjectID;
where Indexes.ObjectType="Index"

That that may help you remember what was indexed with the tagnames.
You can take a peek into the Property Memo, but it won't show you index
expressions. These are lost with the missing CDX.

Bye, Olaf.

Re: Validating a DBC by Olaf

Olaf
Tue Jun 17 23:52:54 CDT 2008

If on the other hand you have a backup version of the cdx
putting it to the dbf and then REINDEX will work to
recover.

So in fact it's sufficient to store the CDX file of the empty
table to recover corrupt CDX files, as long as the index
expressions are only depending on field data and there's
no index on DATETIME() or other "trickery" for example.
This would get updated by REINDEX to the current
DATETIME() of course.

Regarding referential integrity rules and relations, these should
still exist. If not, modify database and make the needed
relation(s),set up the rules for insert/update/delete and
build the RI code.

Bye, Olaf.

Re: Validating a DBC by Alejandro

Alejandro
Thu Jun 19 14:24:37 CDT 2008

Thanks Olaf.




Re: Validating a DBC by Olaf

Olaf
Fri Jun 20 03:16:19 CDT 2008

Hello Alejandro,

glad it could help you.

Bye, Olaf.