0

I have an accounting system running, and I'm receiving transactional error while opening a certain database. The problem is that some index files (CDX) are corrupt. The table file (DBF) seems to be perfect. I can open it and read it all even with Excel. How can I rebuild these cdx files with visual fox pro?

I'm trying:

Use mydatabase.DBF exclusive

Reindex

Close all

But it's generating a FXP file. I'm not sure if this will work or what should I use.

Also, forgive me if I'm doing something totally wrong with this. I'm trying to learn VFP in this moment, since I need to fix this trouble.

Thanks in advance.

LeanDroid
  • 43
  • 1
  • 2
  • 8

4 Answers4

4

Where are trying those commands? If it's from the Command Window, that should work (though REINDEX isn't really the best way to fix broken indexes). If you put them in a program, then running that program will generate an FXP, which is a compiled program.

Rather than using REINDEX, which can propagate broken tags, it's better to get a list of all the tags in the CDX, and then issue:

DELETE TAG ALL

and then using the INDEX command to recreate all the tags. (That said, there are situations where that's not a good idea, as well. If the table belongs to a database (DBC), and it's involved in persistent relationships, DELETE TAG ALL can break those.)

Tamar

Tamar E. Granor
  • 3,817
  • 1
  • 21
  • 29
1

The only way I think you are going to get an FXP file generated via Reindex command is if your index (cdx file) contains a function call. FXP files are compiled PRG (program files). They normally are NOT part of indexes but can be used.

To find out if you have one of these index tags, after you issue USE MYDATABASE.DBF EXCLUSIVE command, type DISPLAY STATUS in the command window. That command will list all the index tags in your structural CDX file.

Example:

  Structural CDX file:   C:\PRO60\ARDATA\ARCUST02.CDX
        Index tag:   ADDRESS1     Collate: Machine    Key: UPPER(ADDRESS1)
        Index tag:   ADDRESS2     Collate: Machine    Key: UPPER(ADDRESS2)
        Index tag:   CURRENCY     Collate: Machine    Key: CURRENCY
        Index tag:   COMPANY1     Collate: Machine    Key: "G_RETSDX(COMPANY)"

The last tag contains a function call. In the above example, reindexing would require access to the G_RETSDX() function.

That explains your FXP issue. However, this may not address your "transactional error"... you are going to have to be a little more specific on the exact error message to understand what is going wrong.

Ed Pecyna
  • 401
  • 3
  • 7
0

There is a one-to-one mapping between dbf files and cdx files.

Is 'mydatabase' the same name as the cdx file? If not, but you know that's the correct cdx file, you'll have to open it manually (I don't remember how to do so).

Ethan Furman
  • 63,992
  • 20
  • 159
  • 237
0

This solution for Oracle databases, if you use other product for work with dbf files, this guide won't help you!

Copy your files, all the database files (control file, redo logs, data, configuration files...) in the new hardisk, if possible at the same location (directories). Then use oradim to create the service: oradim -new -startmode manual Start the service if it is not already started. Execute sqlplus "/ as sysdba" and try a startup. If all files were copied in the same location, this should work.