Rebuilding a Data Source: The REBUILD Command

You can make a structural change to a FOCUS data source after it has been created using the REBUILD command. Using REBUILD and one of its subcommands REBUILD, REORG, INDEX, EXTERNAL INDEX, CHECK, TIMESTAMP, DATE NEW, and MDINDEX, you can:

You can use the REBUILD facility:

Before using the REBUILD facility, you should be aware of several required and recommended prerequisites regarding file allocation, security authorization, and backup.



Reference: Before You Use REBUILD: Prerequisites

Before you use the REBUILD facility, there are several prerequisites that you must consider:

  • Allocation. Usually, you do not have to allocate workspace prior to using a REBUILD command. It is automatically allocated. However, adequate workspace must be available. As a rule of thumb, have space 10 to 20% larger than the size of the existing file available for the REBUILD and REORG options.

    The file name REBUILD is always assigned to the workspace. In the DUMP phase of the REORG command, the allocation statement appears in case you want to perform the LOAD phase at a different time.

  • Security authorization. If the data source you are rebuilding is protected by a database administrator, you must be authorized for read and write access in order to perform any REBUILD activity. For more information on data source security, see Providing Data Source Security: DBA.
  • Backup. Although it is not a requirement, we recommend that you create a backup copy of the original Master File and data source before using any of the REBUILD subcommands.


Procedure: How to Use the REBUILD Facility

The following steps describe how to use the REBUILD facility:

  1. Initiate the REBUILD facility by entering:
    REBUILD
  2. Select a subcommand by supplying its name or its number. The following list shows the subcommand names and their corresponding numbers:
    1. REBUILD        (Optimize the database structure)
    2. REORG          (Alter the database structure)
    3. INDEX          (Build/modify the database index)
    4. EXTERNAL INDEX (Build/modify an external index database)
    5. CHECK          (Check the database structure)
    6. TIMESTAMP      (Change the database timestamp)
    7. DATE NEW       (Convert old date formats to smart date formats)
    8. MDINDEX        (Build/modify a multidimensional index)

Your subsequent responses depend on the subcommand you select. Generally, you will only need to give the name of the data source and possibly one or two other items of information.



Controlling the Frequency of REBUILD Messages

When REBUILD processes a data source, it displays status messages periodically (for example, REFERENCE..AT SEGMENT 1000) to inform you of the progress of the rebuild. The default display interval is every 1000 segment instances processed during REBUILD retrieval and load phases. The number of messages that appear is determined by the number of segment instances in the FOCUS data source being rebuilt, divided by the display interval.



Syntax: How to Control the Frequency of REBUILD Messages

REBUILD displays a message (REFERENCE..AT SEGMENT segnum) at periodic intervals to inform you of its progress as it processes a data source. You can control the frequency with which REBUILD displays this message by issuing the command

SET REBUILDMSG = {n|1000}

where:

n

Is any integer from 1,000 to 99,999,999 or 0 (to disable the messages).

A setting of less than 1000:

  • Generates a warning message that describes the valid values (0 or greater than 999).
  • Keeps the current setting. The current setting will either be the default of 1000, or the last valid integer greater than 999 to which REBUILDMSG was set.


Example: Controlling the Display of REBUILD Messages

The following messages are generated for a REBUILD CHECK where REBUILDMSG has been set to 4000, and the data source contains 19,753 records.

STARTING..
REFERENCE..AT SEGMENT    4000
REFERENCE..AT SEGMENT    8000
REFERENCE..AT SEGMENT   12000
REFERENCE..AT SEGMENT   16000
NUMBER OF SEGMENTS RETRIEVED=   19753
CHECK COMPLETED...

WebFOCUS