Kbase P26318: How to dump around corrupted records
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  11/13/2009 |
|
Status: Verified
GOAL:
How to retrieve as many records from a Table as possible after corruption
GOAL:
How to dump around corrupted recid
GOAL:
How to dump around corrupted rowid
GOAL:
How to ASCII dump a table contents with 4GL
FACT(s) (Environment):
All Supported Operating Systems
Progress/OpenEdge Versions
OpenEdge Category: Database
FIX:
To 'dump around' the corruption, dump the records into a text file using 4GL/ABL, before and after the trouble record.
The following sample 4GL programs demonstrate the method.
Note: "Table_Name" needs to be replaced by the Table in question.
/*before*/
OUTPUT TO "before.d".
FOR EACH Table_Name BY ROWID(Table_Name):
EXPORT Table_Name.
END.
OUTPUT CLOSE.
Errors relating to the corrupt record will appear again and the dump will stop at this point,
but all the records before the bad record will be saved into "before.d" file. Rename this file.
/* after */
OUTPUT TO "after.d".
FOR EACH Table_Name BY ROWID(Table_Name) DESCENDING :
EXPORT Table_Name.
END.
OUTPUT CLOSE.
Errors relating to the corrupt record will appear again, but all the records after the bad record are saved into "after.d" file. Rename this file.
If there are more then one bad records, the record identifier reported in the 'before' export operation error message, will not be the same as the record reported in the 'after' export operation. In this case, the "before" code then needs to be re-run only in ASCENDING order to recover the maximum possible records. This method records the last ROWID in a text file: "befoid.txt", to keep track of where the export has succeeded up to by using:
"STRING ( ROWID(Table_Name) )" as follows:
/* before_skip1.p BEG */
DEFINE STREAM data1.
DEFINE STREAM data2.
OUTPUT STREAM data1 TO "before.d".
OUTPUT STREAM data2 TO "befoid.txt".
FOR EACH Table_Name BY ROWID(Table_Name):
EXPORT STREAM data1 Table_Name.
/* the following line is uncommented if you want to SEE all the rowids on th