Try OpenEdge Now
skip to main content
Database Administration
Protecting Your Data : Recovering a Database : Dumping tables from a damaged database
 

Dumping tables from a damaged database

Occasionally, data is damaged and the index rebuild utility does not work. When this happens, you can use the p-dump.p procedure to dump the data in a table called item. The p-dump.p procedure runs slowly on large databases. Use it only when you cannot use the Index Rebuild utility.
Table 26. p-dump.p
DEFINE VARIABLE ix AS INTEGER NO-UNDO.
FIND _file "item".
OUTPUT TO item.d.
DO ix = 1 TO 10000:
  FIND item WHERE RECID(item) = ix NO-ERROR.
  IF AVAILABLE item AND ix <> INTEGER(_file._template) THEN
    EXPORT item.
END.
In this procedure, data from the item table is dumped into the item.d file. Use the item.d file with the reload procedure. For more information on loading, see Dumping andLoading
In the p-dump.p procedure, you must set the end value for the DO block high enough (10,000 in the previous example procedure) so that every record in the database is examined. Calculate a safe value using the following formula:
100 + 32*(database-size-in-bytes / database-block-size)
The database block size varies among systems. Use the PROSTRCT STATISTICS utility to determine the database block size for your system.