[Return to contents]
Recovering deleted records
Last updated: 28 Nov 2003 by XpertSS.com
If you have compressed the database then the deleted records have been discarded and cannot be recovered. Your only recourse would be to recover using a good recent backup of the database.
If you haven't compressed the database but your database has memo or PicturePlus fields in the deleted records, you can recover the base records but not these types of fields. This is because the "pointer" to them in the .DBT file is zeroed out when the record is marked deleted. These fields would need to be reentered or recovered from a good recent backup of the database by isolating the "deleted records" so that you can export only the fields you need! Or you could take the recovered database and join it to the backup database and copy over the missing fields that way.
Some ways to recover deleted records:
Note that what you need to do is in some way remove the "deleted" tag from the base records in the .DBF file.
1) Get a utility program designed for the purpose.
Some utility programs will let you undelete one record at a time, or all deleted records at once, or simple export all records to another set of files.
- One that has been recommended on the mailing list is a small freeware tool called Database Manager, which can be downloaded from http://www.inner-smile.com/ Make sure you read the readme.txt file carefully. You find it has three levels of access, and recovering deleted records requires full access. Deleted records are "grey" in the listing and there is an icon to undelete the selected row.
- Another one is dSalvage Pro ($199.95 from http://www.accutek.com/comtech/) which can undelete records and it has a way to rematch memo fields (not PicturePlus fields) to their base records providing you have something in the memo field to identify its base record match. This could be very laborious on a large database or with recovery of many deleted records! There are many more useful features in this utility program to consider when evaluating it.
2) Use the 32-bit ODBC driver and Approach.
You can use ODBC to open your .dbf with Approach and recover deleted base records. If you do not already have the 32-bit ODBC option in your Control Panel, download and install the driver for your operating system from Microsoft's web site.
The following steps were tested on a W95 system:
If you do not have any memo or pictureplus fields, the exported .dbf and .adx files will have all the records restored and can be used in place of the original database. Note that the field names and serial number defaults will not be the same as your original database because ODBC does not use the SmartIndex .ADX file, so you may want to import the exported database into the original database with the update and add records option to add back the deleted records and preserve your field definitions.
- Open the ODBC Data Source Administrator from Control Panel.
- On the User DSN page, Click the "Add" button to add a data source.
- Select the "Microsoft dBase Driver(*.dbf)" driver then click the "Finish" button.
- Enter a data source name of your choice and description.
- Select the Database Version as dBase IV.
- Uncheck the "Use Current Directory" check box.
- Click the "Select Directory" button and navigate to the folder where your .dbf file is located. Select the .dbf file name, then the "OK" button.
- Click the "Options" button and you will see a checkbox for "Show Deleted Rows" which you must check to see the deleted records.
- Open Approach, then use File, Open and select the "ODBC Microsoft dBase Driver(*.dbf)" option in "Files of type:". You will need to navigate down the path double-clicking the "Connection DBASE", then the folder-name path to your ODBC source, and then the .dbf file name. Then click the "Open" button.
- Use File, Export Data to export all records to a new dbf, same name, different folder.
- Use the new dbf to restore the deleted records as follows:
If you have memo or pictureplus fields, you should not use the exported database as a substitute. Import the exported database into the original database with the update and add records option to preserve existing records with all fields, add deleted records, and preserve field definitions.
3) Use a text or hex editor program
It is also possible to recover base records by opening the .dbf in a text editor or hex editor, and replacing the asterisk at the beginning of a deleted record with a space character. If you have only one or two records to fix, this may be the simplest method. However, this is not recommended because you may damage the database instead of fixing it! If you decide to try it, use a copy of your .DBF file, PLEASE!