REBUILD


During the development and use of your database, you may find it necessary to make changes to the schema of a populated database. These changes might include adding, modifying, or deleting the field of a relation, modifying the key fields of a relation, or modifying the list of values for an enumerated field. These and any other changes to the schema of a populated database cause a version flag to be reset, necessitating a rebuild of the affected relation(s). This is done using the REBUILD program. This stand-alone tool reformats the data file(s) and/or rebuilds the index file of a relation. Reformatting also removes unused space from the data files. REBUILD also creates a log file listing the transactions and error messages each time a new DFL is opened. The log file will have the same name as the current DFL with the extension of .RBD. REBUILD consists of two files:

REBUILD.EXE

REBUILD.DFL

These files may reside anywhere on your personal system or network. The REBUILD program may be executed as follows:

        REBUILD PATH = pathname D=database PW=password
        or
        REBUILD database
        or
        REBUILD
        where
        PATH    =  path to the REBUILD program and its required files
        PW    =  password for general database access
        D or DB  =  the database name and optional path
      
The database dictionary file name may be supplied in the execution line as shown using the "DB" or "D" parameters or as one of the options within the REBUILD program. In either place, the path (including drive and directory) may be provided as well as the suffix if other than ".DFL." If no suffix is provided, ".DFL" will be appended to the supplied data dictionary file name.

The PATH parameter allows REBUILD program files to reside within any directory on your system. This statement allows the REBUILD program to access necessary information from the REBUILD.DFL file, and provides a way to execute the REBUILD program from anywhere within your system by using a ".BAT" file. A sample of such a ".BAT" file follows:

C:\ADA\THOR\REBUILD.EXE PATH=C:\ADA\THOR\ D=%1 PW=%2

This way REBUILD can be executed from any directory.

REBUILD uses a form to input the information required, or it may be input when REBUILD is first executed. Examples include the following: REBUILD

This will display a form that requests relation and .DFL file information. It will look for the REBUILD.DFL file in the current directory or one of the standard directories (\BATCH\, \SAGE\, \THOR\, \, \DOS\).

REBUILD PATH=D:\MYDIR PW=MyPW,YourPW

This will display a form which requests relation and .DFL file information. It will look for the REBUILD.DFL file in the directory specified by the "PATH" statement or one of the standard directories. As shown, you may specify any passwords (up to two) required for database access.

REBUILD RelName [D:\MYDIR\]MY.DFL [PW=MyPW,YourPW]

This will attempt a database index rebuild of the "RelName" relation as defined in the "MY.DFL" file.

REBUILD RelName [D:\MYDIR\]NEW.DFL [D:\OLDDIR\]OLD.DFL [PW=MyPW,YourPW]

This will attempt a database reformat/rebuild of the "RelName" relation as previously defined on the "OLD.DFL" file to the new format described on the "NEW.DFL" file.

REBUILD FILE=MYFILE.INP

This will read the file specified by the "FILE=" statement ("MYFILE.INP") and retrieve a command from each line of that file to be used to rebuild and/or reformat the specified relation(s). The format of the command lines on the input file are the same as the format which is acceptable following the REBUILD execution statement. Depending on how you invoke REBUILD, the initial screen may be different. For example, if you type REBUILD and do not specify a .DFL, Figure 9 will be displayed. On the other hand, if you specify the .DFL you will bypass Figure 9 altogether. The following writeup will assume you have simply typed REBUILD with no other parameters.

The REBUILD program compares the current and previous schema definitions for the relation, adjusts the existing database files to fit the new schema, and tags the database files with the new version so that SAGE will allow access to them. Then the index file for the relation is rebuilt. SUBTOPICS

Selecting a DFL

Tagging Relations to Rebuild

Select the Type of Rebuild Go Back To Sage-ST TABLE OF CONTENTS


warren.merrill@inl.gov , ftp://sage.inel.gov
Copyright © 1989-2006. Battelle Energy Alliance