Verify and recover an APPXIO file
Start with Verify Files. If verification fails, preserve a copy of the data and key files before attempting a rebuild or recovery.
Separate diagnosis from recovery
- Use Verify Files in Data File Management. The command-line equivalent is the engine's
-voption. Record the exact result and filename. - Use
-anfor more detail. At theBRF>prompt,VERIFY KEY #ALLcompares the number of data records with the key count for each index. - Keep users out of the file while making repairs. Work on a copy first and compare the recovered record count with a known good backup. The FREELIST discussion below concerns APPX 4.0.a and earlier.
Verifying and Analyzing a File
You can verify a file's integrity from the Data File Management menu ('Verify Files') or from the command line. To verify files from the command line:- Windows
%APPXPATH%\..\appx.exe -v={filename}- Unix
$APPXPATH/../appx -v={filename}
- Windows
%APPXPATH%\..\appx.exe -an={filename}- Unix
$APPXPATH/../appx -an={filename}
HELP- list all available commands.
DUMP HEADER- will give you info about the file, including the number of keys.
COUNT REC- will give a count of the number of records that {FILENAME.dat} believes it contains.
VERIFY KEY #0- verifies the primary index, and gives # of records.
VERIFY KEY #1- verifies the alt index #1, and gives # of records.
VERIFY KEY #2- verifies the alt index #2, etcetera ...
QUIT- exit the "-an=" utility.
FREELIST damage (APPX 4.0.a & earlier)
A type of file damage that VERIFY KEY #ALL does not tell you about is freelist damage. The freelist is the list of pointers in AppxIO files that point to deleted records. This list can get damaged. It could for example point to a live record, indicating erroneously that it is deleted. Up through APPX version 4.0.a the menu driven Verify Integrity utilities, the 'appx -v={filename}, and the 'appx -an={filename}', VERIFY KEY #ALL option don't detect such damaged freelist conditions. To find a damaged freelist condition, you must use the APPX engine (the engine is all that's necessary) release 4.1 or higher, then go into the BRF> command line from 'appx -an={filename}', then execute the command:VERIFY FREELISTIf the freelist is damaged, this command will give you an error condition to that effect. To repair the damage, execute:
VERIFY KEY #ALLIf the file passes this verification, you may safely export and re-import the file, in order to initialize its freelist.
Recovering a Damaged File:
These techniques require thought knowledge of the Appx directory/file structure as well as the associated application files and processing. If you have any questions after reading these procedures, please call Appx Technical Support (1-800-879-2779) before proceeding. There are several techniques that may recover damaged file(s). We recommend that you back up your files before attempting one these techniques. Select the appropriate method after careful analysis of your particular situation.Important Note
The Export and Import utilities should not be used for recovering a damaged file. In all likelihood this method will result in lost data.Rebuilding the key file
This is the easiest & simplest type of recovery. Either delete or rename the existing .key file, then run 'Create Files' on the Data File Management menu. This will rebuild the key file, and when it is complete run the 'Verify' step again to check the record counts and confirm the file is good. Even if the file passes verification, you might have lost data. If possible, check the file to see if any valid data was lost.Restoring files from Backup
Note that all work performed since the backup was made will be lost. When restoring design files, the entire application should be restored from backup, not just a single file. The best course of action is to restore all of the applications for the version to ensure that design integrity is maintained across applications. When restoring data files, it may be necessary to restore the entire database. For example, it makes no sense to restore an Order file without also restoring its line item file. Consider other files which may have been updated during the course of processing. Those files may also need to be restored.APPX Recover Utility
If the above techniques aren't successful, then you can run the Appx Recover Utility. This is the safest method for recovering your damaged or corrupt file(s). You can also use this technique to recover accidentally deleted records, if you can perform this procedure in time. Since APPX re-uses deleted records, if new data is added after the deleted records, the deleted record may already be overwritten. Usage:- Windows
%APPXPATH%\..\appx.exe -r old.file new.file [deleted.record.file]- Unix
$APPXPATH/../appx -r old.file new.file [deleted.record.file]
APPX Recover Utility:
Input Filename = C:\32\DATA\ttt\PAT\Data\bb.dat
Output Filename = C:\32\DATA\ttt\PAT\Data\bx.dat File Header Information:
File Organization = 3 ( Fixed Length Records )
Record Length = 19
UnixIO Version = 2
Freelist Starting Address = 0
End of File Address = 617 Recover Completion Information:
Active Records Copied = 3
Deleted Records Removed = 0
Overhead Records Removed = 0
File Errors Found = 0
New Eof Seek Location = 617
Space Allocation Reduction = 0 bytes
* You MUST create a new '.key' file that matches your new '.dat' file!