FAQ's - APPX Software, Inc. : Trash :
624 - File Analysis and Recovery | |
The appxutil.exe and recover.exe utilities, found in the /tools directory below the appx.exe engine, allow batch manipulation and recovery of AppxIO files in the Windows environment, from a DOS popup box. Similar utilities, called 'appx' and 'recover', perform the same functions in Unix.
Command Line Invocations: appxutil.exe or appx Command Line Invocations: appxutil.exe or appx 'appxutil.exe' lets you perform switched invocations of APPX for Windows, without clearing the DOS box. From a Unix prompt, the command is simply 'appx'. Here's how you would use switches to verify and analyze APPX data files:
Issuing in the DOS box the command ... appxutil -u | more Or in Unix, the command ... appx -u | more
Usage: -k define a new keymap
Restrictions: If no application_id is specified, the startup application and menu for the database is used. If no database_id is specified, the startup database defined for the user within System Administration is used. If the startup database is also unspecified, the APPX main menu is used. The valid process_types are Menu, Job, Input, Output, Update, Action, Inquiry, Query, Status, and Subroutine. Use underscores (_) in place of embedded spaces within parameters. Substituting the "-k" through "-l=" switches will let you specify particular actions upon invoking the appx.exe engine. (Consider the possibility of building your desired command line invocation strings in MS Word, Notepad or WordPad, then cutting and pasting them into your DOS box.) For more information on appxutil.exe, see the APPXUTIL Overview. Verifying and Analyzing a File
In Unix: $APPXPATH/../tools/appx -v={filename} ... will manually verify an APPX datafile. This does the same thing as interactive "Verify Files Menu", "Verify Integrity" from the Database, Design File, and System Administration File Management menus, but from a command line. If the invocation of this command results in no output, then the file passes verification. Any output from this command means that the file fails verification. To analyze a damaged file ... In Windows: %APPXPATH%\..\tools\appxutil.exe -an={filename} In Unix: $APPXPATH/../tools/appx -an={filename} ... gives you a "BRF>" prompt for {filename}. The most useful command at this prompt is ... VERIFY KEY #ALL which performs counts the number of records in the .dat portion of the file verifying the .dat as it goes, and verifies all Keys in the .key portion of the file. Other useful commands are: 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. If the file doesn't pass #ALL verification, but does pass COUNT REC verification, then it means that the *.dat portion of the file is probably OK, but the *.key indices are probably damaged. In this case, rename or delete the *.key file, then run 3)CreateFiles. This will recreate your indices from scratch. (For quite large files, it may be faster to use the 'recover.exe' procedure below, the 3)CreateFiles to recreate your keyfile, albeit at the cost of more designer time required to do this safely.) If the file doesn't pass COUNT REC analysis, you have a seriously damaged *.dat file. Your best bet at this point is to use the "Recover.exe" procedure below, or if necessary restore from backup. FREELIST damage 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 (and perhaps higher), 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.0.a or higher, then go into the BRF> command line from 'appx -an={filename}', then execute the command: VERIFY FREELIST If the freelist is damaged, this command will give you an error condition to that effect. To repair the damage, execute: VERIFY KEY #ALL If the file passes this verification, you may safely export and re-import the file, in order to initialize its freelist. If the file doesn't pass #ALL verification, but does pass COUNT REC verification, then it means that the *.dat portion of the file is probably OK, but the *.key indices are probably damaged. In this case, rename or delete the *.key file, then run 3)CreateFiles. This will recreate your indices from scratch. It will then be safe to export and re-import the file. (For quite large files, it may be faster to use the 'recover.exe' procedure below, then 3)CreateFiles to recreate your keyfile, albeit at the cost of more designer time required to do this safely.) If the file doesn't pass COUNT REC analysis, you have a seriously damaged *.dat file. Your best bet at this point is to use the recover.exe procedure below, or if necessary restore from backup. File Recovery: recover.exe or recover
Usage: In Unix: $APPXPATH/../tools/recover old.file new.file [deleted.record.file]
Deleted Records are discarded, unless a third filename is given on the command line. In this case, the deleted records are copied to the given file. This file is a fixed-length consecutive file. To access it from within APPX, you must design transfer your data dictionary, remove the indices, and change the file type to consecutive. This is needed since the deleted records could contain duplicate key values. Overhead blocks are also removed. These blocks are used to track deleted record space within the file for reuse. Since the new file has no deleted record space, it no longer needs these blocks. This utility does not deal with duplicate primary or unique alternate indices. *** IMPORTANT *** Any file you recover must have a new *.key file built. This is done by renaming or deleting the *.key file, then running 3)Create Files. The *.key file contains pointers to all of the data records in the *.dat file. By recovering the *.dat file, you invalidate the original *.key file.
Example: recover.exe C:\APPX\DATA\DDD\PAT\Data\BB.dat C:\APPX\DATA\DDD\PAT\Data\BB.new ... will generate the following output and files ...
APPX Recover Utility: Input Filename = C:\32 *** You MUST create a new '.key' file that matches your new '.dat' file! What to do with a file that Fails Verification? If 13)Verify 1)Integrity results in a 'Failed' condition, perform the following procedure: 1) If you are running under Unix, su to the appx UserID. 2) Call up a MS-DOS Command box (or Unix Command prompt). Change directories:
cd {appx.exe.folder}\data\DDD\AAA\Data (If you are using FMS Groups, adjust this 'cd' accordingly.) Example:
D:
3) Type: ... where FILE is the name of the file you are recovering. 4) From the Command prompt, perform:
ren FILE.dat FILE.dat.keep
This moves the original FILE.* files out of the way (but keeps them around a while in case they're needed), then moves the recovered FILE.new into place as the new FILE.dat. 5) Go back to Database Management (or Design File Management) for your application. Run 3)Create Files on FILE. This creates a new FILE.key to go along with your recovered FILE.dat.
To double-check, run 13)Verify Menu, 1)Integrity to confirm that the file is OK, and that the Active Records Copied above equals the number reported in the Verify Integrity utility.
| |
[Append to This Answer] | |
2010-May-20 12:29am |
Previous: | 603 - Automating Export/Import with Unix Crontabs |
Next: | 627 - Moving APPX Files Between Platforms |
|