Consultor Eletrônico



Kbase 18440: How To Rebuild only Primary Indexes
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/07/2007
Status: Unverified

GOAL:

How to Rebuild only Primary Indexes

GOAL:

What is the primary index for every table

GOAL:

How to generate a list of primary indexes

FIX:

As long a 4GL or ProVision client can be used to connect to the database, the following code provides an example of how a list of tables and their primary index can be generated.

OUTPUT TO "prime.file".
PUT UNFORMATTED "some" SKIP.
FOR EACH _file WHERE _file-number > 0 AND NOT _file-name BEGINS "SYS":
FOR EACH _index OF _file WHERE RECID(_index) = _prime-index:
PUT UNFORMATTED _file-name SKIP _index-name SKIP.
END.
END.


PUT UNFORMATTED "!" SKIP.
PUT UNFORMATTED "Y" SKIP.
PUT UNFORMATTED "Y".OUTPUT CLOSE.This procedure will generate a file named prime.file for the database it was generated against.

Before running and index rebuild, it is strongly advised that a fully verified database backup be made available.

The index rebuild can then be run by passing the generated list as input to selectively re-build only the primary indexes:
_proutil <dbname> -C idxbuild -TB 31 -TM 32 -B 512 < primes.txt

If the database is larger than 2 GB, the script could be split into several parts, optimally the rebuild needs to be done with sorting. Please refer to the Solutions referenced below.