Skip to content

Data Recovery Techniques

Media and Hardware Errors

If there is a problem with your equipment, disk media, or operating system, it will usually show up in the filing system. If a program that was working properly suddenly stops working, it is usually (but not absolutely always) some sort of hardware or media problem.

A problem that does not happen consistently under exactly the same conditions is almost always a hardware problem. If you have this type of problem, you should run all of your system diagnostics several times. You should also test other software that uses similar resources. After any hardware malfunction, the reindexing utility in Database Builder should be used.

Media and hardware errors refer to problems that result in physical corruption of the data on your disk, not operator or program error. There are two primary causes for these errors: disk media defects and power failure. There is a good statistical probability that eventually you will have a media failure. It is equally true that you will have power failures.

DataFlex keeps all of your data current on disk in case of power failure, but different equipment and operating systems have different capacities for coping with this problem. Some poorly designed equipment can destroy an entire disk if the power goes out at the wrong time, while others handle it with almost no effect.

Probably the worst case is when a system makes small, almost undetectable errors on the disk after a power failure. Some power "flickers" or "spikes" can cause data errors that are unnoticed at the time they occur. After a power failure, flicker or spike, or a media error, you should use the reindexing utility in Database Builder to ascertain the extent of data corruption and re-establish data integrity.

It is most important to maintain recent backups to guard against these data killers. On any system storing and/or accessing database tables, you should purchase an uninterruptible power supply (UPS) to prevent power failure and surging problems.

Why Would You Need to Recover Data?

Due to power problems, media failure, and sometimes program code errors, it may become necessary to restore the integrity of your data. This recovery may be necessary on several levels:

  • If you have a corrupted disk directory, you will need to recover all of the files on a disk (primary data recovery).
  • If only one file is corrupted, there are specific methods for recovering one file (secondary data recovery).

Before you start any kind of data recovery, you should consider whether it is worthwhile. Assuming you have made proper backups, it may be simpler to restore your backups and bring those files up to date by manually re-entering data!

Read Caching and Opportunistic Locking

Verify proper configuration of Read Caching and Opportunistic Locking on your network.

Repairing the Embedded (DataFlex) Database

If you experience data corruption in embedded database tables, there are a number of steps you can take to repair the database before moving on to the data recovery steps outlined in the Primary Data Recovery and Secondary Data Recovery sections below. The steps that you may be able to take or will help your situation will vary with the type of data corruption you are experiencing.

  • If indexes are damaged, you can reindex the database from Database Builder's Maintenance menu. If the damage in the data file extends beyond indexes, the database will have to be repaired before reindexing.

  • If header integrity checking is enabled in the table, then damaged headers can be repaired from Database Builder's Maintenance menu.

  • You can launch the DataFlex Repair wizard from Database Builder's Maintenance menu. This wizard can fix the following database damage:

  • A mismatch between the total number of record slots in the header and the actual total in the table.

  • A damaged free records list.
  • If the damaged table is using compression, you may be able to salvage the data by uncompressing or recompressing the table.
  • If your database is only partially damaged, you may be able to recover some, most, or all of the data in it and rebuild the database.

Rebuilding an Embedded (DataFlex) Database Table

Rebuilding an embedded database table requires the following steps:

  1. Export data from the damaged table (if possible) into another table (or an ASCII file or any other storage method you wish to use).
  2. Delete the damaged table.
  3. Recreate the table from its definition.
  4. Import the data back into the new table.

Here is one method you may use to rebuild an embedded database table:

  1. Make sure you have an up-to-date definition (.DEF) file for the table.
  2. Create another table with the identical table definition. You can do so by using the Load DEF option in Database Builder.
  3. Use the Copy Records option on Database Builder's Maintenance menu to copy records from the damaged table to the new table.
  4. Delete the damaged table.
  5. Re-create the original table (with the original table name). You can do so by using the Load DEF option in Database Builder.
  6. Use the Copy Records option on Database Builder's Maintenance menu to copy records from the new table back to the original table.

Primary Data Recovery: Corrupted Directory

If the directory on your disk is corrupted (see Media and Hardware Errors), you will need to restore the integrity of the disk before you start on the individual database tables.

You should first make another backup of your entire disk drive and then reformat the disk according to the operating system instructions. Do not make an "image" backup of the type supported by some backup systems. In such systems, be sure to use the "file-by-file" mode. Next, verify the disk drive to make sure there are no media errors.

Finally, restore the files from your backup. You should examine all data files for correctness and proceed with secondary file recovery on all files.

Secondary Data Recovery: Corrupted File

If the integrity of any embedded (DataFlex) database table is suspect, you should use the reindexing utility in Database Builder on each file. The reindexing utility will restore the internal list of deleted records in the .DAT file and recreate the indexes. If there are any bad or duplicate records in the table, they will be removed.

After this procedure, it’s a good idea to use Database Explorer to look at the data in the tables. If reindexing cannot recover the badly damaged data, it is usually better to restore the tables from backup than to try further recovery. Let us emphasize the importance of good backups!

Common errors associated with media and hardware failures are:

  • SYSTEM STOPS OR "LOCKS UP" at random times
    Most probably a power flicker or spike! (Also check available memory)

  • BDOS Error: Bad Sector; I/O Error; Read/Write Error
    These errors are returned directly from the operating system, not from DataFlex. The exact wording may vary from system to system. This type of error is caused by an unrecoverable hardware or media error. The first thing to do is to reformat and restore your data from backup.

If this happens frequently, your hardware should be examined. If you use DVDs, CD-ROMs, floppy disks, or other removable media, you should consider another brand.

Disk Limitations

Each database table and program file takes up disk space. You may run into this at any time whether creating, editing, or compiling any type of file. The error code for a full disk depends on what type of file you are processing. (The error when you are running a DataFlex application is different from the same error when you are using the Studio or compiler).

In any case, you will either have to reorganize the files on your disks or get more storage space. Additionally, be aware that the last edit or addition you attempted was probably not saved properly.

Note that there are two ways to fill up your disk:

  1. The storage can be used up.
  2. The directory (number of files) can be filled up.

Both of these conditions are treated in the same way; you must remove files from your disk.