When an error 1124 occurs on a Storage Area that only contains indexes and no data, the following documents an alternative to dump and reload to fix the index block corruption.
Before going through the following steps to fix the problem, it cannot be stressed enough that a thorough hardware check should be carried out, as a persistent error 1124 is caused by pre-existing a hardware problems almost all of the time. Please refer to Article
0. Ensure an OS copy backup of the current Database areas before starting.
1. Query to list all index names in the corrupted Storage Area.
The following ABL code warns if the Storage Area contains objects other than indexes, in which case the following steps in this fix cannot be applied
as all the data in these tables will no longer be available!
FIND _area WHERE _Area._Area-Name = "OldIndexes".
FOR EACH _StorageObject WHERE _StorageObject._Area-number = _Area._Area-number:
IF _StorageObject._Object-Type <> 2 THEN DO:
MESSAGE "Storage area" _Area._Area-Name "does not only store indexes!"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
FIND _Index WHERE _Index._Idx-Num = _StorageObject._Object-Number.
FIND _File OF _Index.
DISPLAY _File._File-name _Index._Index-name.
2. (Optionally) Move the Storage Area to a new location. If a disk hardware problem is suspected then copy these files to a new disk.
Update the database structure file:
$ prostrct list <dbname> <dbname>.st
OS Copy the Storage Area extents to a new location.
Open the database structure file (dbname.st) in a text editor and update the full path of the new file location these extent files were copied to in the previous step.
Update the Database Control Area with the new file location:
$ prostrct repair <dbname> <dbname>.st
3. Delete all the index entries by re-setting the High Water Mark
Truncate the before-image file
$ proutil <dbname> -C truncate bi
Truncate the corrupted Storage Area
$ echo y | proutil <dbname> -C truncate area "OldIndexes"
TRUNCATE AREA will list all the indexes contained in the area, which will be the same list as that produced by the ABL program above. Example:
The contents of index "CustNum" will be deleted.
Index "CustNum" was deactivated. (1515)
4. Rebuild all the indexes in this Area with IDXBUILD
In OpenEdge 10 or later, indexes can be rebuilt "By Area" from the IDXBUILD choice list, in other words by this "OldIndexes" Storage Area
The following ABL code will determine which indexes are de-activated at this time, then manually feed the index names by selecting "SOME" from the IDXBUILD choice list:
Note that when "_index_active = NO" this is purely from the AVM perspective. The "_StorageObject._Object-state = 1" identifies the list of indexes that require building from the database perspective.
FOR EACH _index, EACH _file OF _index WHERE _file-number > 0 AND NOT _file-name BEGINS "SYS": /* WHERE _index._active = YES : */
FOR FIRST _StorageObject WHERE _Object-state = 1 AND _Object-number = _idx-num:
DISP _file-name SKIP _index-name SKIP.
Once the idxbuild utility has completed, take a new PROBKUP of the database before starting for production.