How Do You Rebuild a Corrupt Elliott File?

How Do You Rebuild a Corrupt Elliott File?

Release Date: 05/02/2023
Version: 7. 0 & Up

If a Btrieve data file is corrupt, you can use Butil to rebuild the file. The basic process is to make a copy of the file without any records and then copy all of the records out of the old file into the new copy. Butil will be able to read and extract the records out of the bad file until it encounters a corrupt record, at which point it will stop. There are two methods to copy the records out of the bad file. One method uses the index and the other reads sequentially through the file. Since the two methods use different paths through the file, one method may yield more records than the other. If you are unable to recover all of the records, it may be beneficial to try both methods. If only the index is corrupt, Butil -Recover may be able to get all of the records.

The utility of Butil.exe can be found in “C:\Program Files (x86)\Actian\PSQL\bin” and this is added to your Command Prompt path when Pervasive is installed.  Butil can be run directly on the server or at a workstation from the command prompt, but we suggest running the rebuild directly on the server for speed and to eliminate the network traffic.

The three methods to rebuild a file are: (1) use the Save command, (2) use the Recover command, and (3) use the Copy command, which is really a subset of method 2.

1) Butil -Save creates a sequential ASCII file from a Btrieve file based on the index. The steps are:

Butil -Clone creates a new, empty file with the same file specifications as the existing file.
Butil -Save reads data along a key path and writes the results to a sequential file.
Butil -Load loads the contents of an unformatted file (from Save) into a data file (Clone file).


2) Butil -Recover creates a sequential ASCII file from a Btrieve file, but uses the physical path to read the records from the file. It reads the Btrieve file from top to bottom. The steps are:

Butil -Clone creates a new, empty file with the same file specifications as the existing file.
Butil -Recover reads data sequentially from a data file and writes the results to an unformatted file.
Butil -Load loads the contents of an unformatted file (from Recover) into a data file (Clone file).


3) Butil -Copy performs in a single step the same functions as the Recover command followed by the Load command. So alternately you could do these steps:

Butil -Clone creates a new, empty file with the same file specifications as the existing file.
Butil -Copy copies the contents of one data file to another.

If you have any problems with the Copy command, we suggest using Recover or Save and then the Load command.

The syntax for these commands are:

Butil -Save {input Btrieve file (the bad file)} {output file}
Butil -Recover {input Btrieve file (the bad file)} {output file}
Butil -Copy {input Btrieve file (the bad file)} {output Btrievefile}
Butil -Clone {output file} {source file (the bad file)}
Butil -Load {input file (the file from save or recover)} {output Btrieve file (your cloned file)}

Type Butil without any options to see a list of options and switches.

PSQL 7.0 introduced to Butil the /I switch, which specifies reading forward through the file, which is the default, and the /J switch, which specifies reading backward through the file. If you use both switches, Butil will read forward through the file from the beginning until it encounters a bad record and then read backwards through the file from the end until it encounters a bad record. If the methods above do not recover all the records, try adding both of the /I and /J switches. See the Pervasive.SQL User's Guide for more information.

NOTE: Butil has a -Salvage option. This is not suggested as it can damage files.

MAD



    • Related Articles

    • Aging Shows Differently After Database Rebuild

      Q - After the database rebuild on A/R Open Item File (AROPNFIL.BTR), the A/R aging shows differently than before. For some reason, the payments are showing before the invoices. Also, they are not in any logical order that we can see. Here are the ...
    • Problems with Using Pervasive Rebuild Utility on APOPNFIL and AROPNFIL Tables

      Q - Recently, we used Pervasive's rebuild utility to rebuild all Elliott database tables (i.e., all \Elliott7\DATA\*.BTR files). After the rebuild, we noticed some strange things happening to our A/P and A/R modules. For example, below is a sample of ...
    • Elliott V7.1 Release Notes: What's New Since Elliott V7.0

      What’s New Since Elliott V7.0 System Wide Features eContact Manager After V7.1, an eContact can be set up even if you don’t have a contact’s email address. The eContact database has been expanded to include Company Name, Birthday, Created By and ...
    • Elliott Installer File-In-Use Warning During Installation

      Q - I am trying to install updates for Elliott. I'm seeing no users in Elliott 7.5 or 8.1 and no open session in Pervasive, but I'm seeing the following message appear: Elliott Installer - File In Use Warning The following files must be closed to ...
    • Introduction to Elliott V8.0: Section 5

      Report Viewer Overview Elliott Report Viewer is a Notepad-like program for viewing Elliott report files while providing additional Elliott functionality. Using Report Viewer, you can: Email the report Print the report Save the report to Spooled ...