---+ File Analysis and Recovery <p align="left">The appx utilities, found in the /tools directory below the appx engine, allow batch manipulation and recovery of !AppxIO files. In the Windows environment, execute these commands from a DOS popup box. Or use the command line to perform the same functions in Unix.</p> <p align="left">%TOC%</p> ---++ <a name="invocations"></a>Command Line Invocations: appx.exe or appx 'appx.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 ... | <p>appx -u</p> | more <p> </p> | | Or in Unix, the command ... | appx -u | more | ... will result in the output ... ---+++ Usage: <pre> -k define a new keymap -m=<[user_id:]keymap_name> override keymap ID -d=<database_id> override startup database -a=<application_id> override startup application -t=<process_type> override startup process type -p=<process_name> override startup process name -i=<flat_file_name> convert a flat file into AppxIO -e=<data_file_name> convert an AppxIO file into flatfile -v=<data_file_name> verify the integrity of AppxIO file -an=<data_file_name> analyze an AppxIO file -l=<log file name> start a license server -r (or -recover) recover damaged files (see below) </pre> ---+++ Restrictions: An application_id and process_type must always be included when specifying a process_name. If an application_id is included without specifying a process_type/name, the startup menu for the application is used. 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. <em><span style="font-size: x-small;"> </span></em> _(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 [[APPXUTILOverview][APPXUTIL Overview]]. ---++ <a name="verifying"></a><a name="verifying/analysing">Verifying and Analyzing a File</a> | In Windows: | <p>%APPXPATH%\..\tools\appxutil.exe -v={filename}</p> | | In Unix: | $APPXPATH/../tools/appx -v={filename} | <a name="verifying/analysing"> ... 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 ... </a> | In Windows: | <p>%APPXPATH%\..\tools\appxutil.exe -an={filename}</p> | | In Unix: | $APPXPATH/../tools/appx -an={filename} | <a name="verifying/analysing"> ... 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: <pre>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.</pre> If the file doesn't pass<span style="font-family: 'Courier New'; font-size: x-small;"> #ALL </span>verification, but does pass<span style="font-family: 'Courier New'; font-size: x-small;"> COUNT REC </span>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<span style="font-family: 'Courier New'; font-size: x-small;"> COUNT REC </span>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 <span style="font-family: 'Courier New'; font-size: x-small;">VERIFY KEY #ALL</span> 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}', <span style="font-family: 'Courier New'; font-size: x-small;">VERIFY KEY #ALL</span> 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: <blockquote dir="ltr"> VERIFY FREELIST </blockquote> If the freelist is damaged, this command will give you an error condition to that effect. To repair the damage, execute: <blockquote dir="ltr"> VERIFY KEY #ALL </blockquote> 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 <span style="font-family: 'Courier New'; font-size: x-small;">#ALL</span> verification, but does pass <span style="font-family: 'Courier New'; font-size: x-small;">COUNT REC</span> 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.)_ </a> <a name="verifying/analysing">If the file doesn't pass <span style="font-family: 'Courier New'; font-size: x-small;">COUNT REC</span> analysis, you have a seriously damaged *.dat file. Your best bet at this point is to use the </a> recover.exe procedure below, or if necessary restore from backup. ---++ <a name="recovery"></a>File Recovery: appx -r (or -recover) ---+++ Usage: | In Windows: | <p>%APPXPATH%\..\appx.exe -r old.file new.file [deleted.record.file]</p> | | In Unix: | $APPXPATH/../appx -r old.file new.file [deleted.record.file] | This utility will read an APPX indexed data file (.dat) and copy the good/active records to the output file. Any corrupt data is hex-dumped to the screen. If you redirect standard output ( <span style="font-family: 'Courier New'; font-size: x-small;">>bad.data</span> ), you can collect any corrupted data into a file, for later examination. 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: The following command (in Windows) ... <span style="font-family: 'Courier New'; font-size: x-small;"> </span> appx.exe -r C:\APPX\DATA\DDD\PAT\Data\BB.dat C:\APPX\DATA\DDD\PAT\Data\BB.new ... will generate the following output and files ... <pre>APPX Recover Utility: Input Filename = C:\32\DATA\ttt\PAT\Data\bb.dat Output Filename = C:\32\DATA\ttt\PAT\Data\bx.dat</pre> <pre>File Header Information: File Organization = 3 ( Fixed Length Records ) Record Length = 19 UnixIO Version = 2 Freelist Starting Address = 0 End of File Address = 617</pre> <pre>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</pre> *** You MUST create a new '.key' file that matches your new '.dat' file! ---++ <a name="FileFails"></a><a name="WhatToDo">What to do with a file that Fails Verification?</a> <a name="WhatToDo"> If<span style="font-family: 'Courier New'; font-size: x-small;"> 13)Verify 1)Integrity </span>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 <em><span style="font-size: x-small;">(or Unix Command prompt)</span></em>. Change directories: <span style="font-family: 'Courier New'; font-size: x-small;"> </span> cd {appx.exe.folder}\data\DDD\AAA\Data ... where ... <span style="font-family: 'Courier New'; font-size: x-small;">{appx.exe.folder}</span> is the directory containing your 'appx.exe' engine, <br /><span style="font-family: 'Courier New'; font-size: x-small;">DDD </span><span style="font-size: x-small;">is your Database ID <span style="font-size: xx-small;">(or for your Appl Design files, the Appl's 2-digit version#)</span>, and </span><br /><span style="font-family: 'Courier New'; font-size: x-small;">AAA </span><span style="font-size: x-small;">is your Application ID.</span> <small> </small> <small> </small> <small> <em>(If you are using FMS Groups, adjust this <span style="font-family: 'Courier New';">'</span></em><span style="font-family: 'Courier New'; font-size: x-small;">cd</span><em><span style="font-family: 'Courier New';">'</span> accordingly.)</em> </small> Example: <span style="font-family: 'Courier New'; font-size: x-small;">D:<br />cd \APPX\data\DBS\APL\Data</span> 3) Type: <span style="font-family: 'Courier New'; font-size: x-small;"> </span> {appx.exe.folder}\tools\recover.exe FILE.dat FILE.new <em>... where </em><span style="font-family: 'courier new';">FILE</span><em> is the name of the file you are recovering.</em> 4) From the Command prompt, perform: <span style="font-family: 'Courier New'; font-size: x-small;"> </span> ren FILE.dat FILE.dat.keep<br />ren FILE.key FILE.key.keep ren FILE.new FILE.dat _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 <em><span style="font-size: x-small;">(or Design File Management)</span></em> 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._ ---++ Comments: _Read what other users have said about this page or add your own comments._ --- <br />%COMMENT% </a>
This topic: Main
>
WebHome
>
SystemAdministration
>
FileAnalysisAndRecovery
Topic revision: r2 - 2012-02-27 - ChrisBrower
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback