Manual Resizing
This topic describes the methods you can use to manually resize a file, data section, dictionary or index.
Changing the Modulo of a File
Four methods for changing the amount of primary space allocated to a file are available on a Reality database. They are:
- Using CREATE-FILE to create a new file with the required modulo.
- Placing resizing parameters in attribute 13 of the file definition item.
- Dynamic resizing using realresize (partition database only).
- System file resizing using the resize configuration file and mkdbase -r command.
Using CREATE-FILE for Resizing
To resize a file using CREATE-FILE:
- Create the new Reality file with the required modulo using the CREATE-FILE command.
- Copy the existing file's contents to the new file using the COPY command.
- Delete the old file using the DELETE-FILE command.
- If required, rename the new file with the old file's name using the RENAME-FILE command.
Using Reallocation Parameters
If you place reallocation parameters in attribute 13 of the file definition item, the next time you perform an ACCOUNT-RESTORE, the software will resize the file.
The resize parameter in attribute 13 of a D-pointer must be of the form (m,n), where m is the file modulus to be used and n is the separation. Separation should always be 1.
Note
Use the R option with ACCOUNT-RESTORE if you want to suppress file resizing during that restore, as resizing a large number of files can delay completion of the restore.
The simplest way to set the reallocation parameters is to use the OPTIMUM-MODULO TCL command to find the best modulo. Then perform a logical save (ACCOUNT-SAVE for example).
When the account is restored, the system resizes the file, applying the new modulo. Subsequent restores will not resize the file unless attribute 13 shows a modulo different from that of the file when saved.
Resizing files is a time-consuming process and should be done as seldom as possible.
Dynamic Resizing (Partition Database Only)
Dynamic resizing, available only on partition databases, enables a file to be resized while still allowing users to access it. This is carried out using the UNIX/Windows-based utility realresize, which can be executed by the database owner by entering the realresize command at the UNIX shell or Windows Command Prompt, or by entering the RESIZE-FILE command at TCL.
Note
While a file is being dynamically resized there are severe restrictions on sequential access to the file (if sequential access is required, there must be an index on the item-id). Also the resize operation on large files is extremely slow, files cannot be reduced in size, and files can only be resized once per database 'session' (all users must be logged off and the database shut down before a file can be resized again).
Resizing System Files
A fourth resizing method is provided specifically for
resizing database system files
(such as SYSTEM,
To resize one or more system files, the database owner must specify preferred moduli in the configuration file resize, which is in the configs directory under the database directory, and then remake the database. For more details, see the topic Resizing System Files.
Changing the Modulo of a Dictionary
Because a dictionary cannot be automatically sized, if you use the default modulo (1) for a large dictionary, it could become badly sized, resulting in poor performance. The recommended method of resizing a dictionary is as follows:
- Use OPTIMUM-MODULO to find the best modulo for the dictionary.
- Create a new dictionary with the required modulo using CREATE-FILE. Specify the S option to suppress the creation of a self-referencing Q-pointer.
- Use the COPY command to copy the dictionary items into the new dictionary.
- Use MOVE-FILE to associate the old file's data sections with the new dictionary.
- Delete the old file.
- Rename the new dictionary to give it the same name as the old file.
For example, to resize the dictionary of the file MYDATA (which has a single data section) to have a modulo of 11, enter the following at TCL:
:CREATE-FILE DICT TEMP 11 (S [417] File 'TEMP' created. D code =DL, modulo = 11, separ = 1 :COPY DICT MYDATA * TO:(DICT TEMP [418] File-definition item 'MYDATA' was not copied. 2 items copied. :MOVE-FILE MYDATA,MYDATA TO:MYACCOUNT TEMP,TEMP The data section that formerly resided in the "MYACCOUNT" account as a data section of the "MYDATA" file and was called "MYDATA", now resides in the "MYACCOUNT" account as a data section of the "TEMP" file and is called "TEMP" :DELETE-FILE MYDATA :RENAME-FILE TEMP TO:MYDATA The file that formerly resided in the "MYACCOUNT" account and was called "TEMP" now resides in the "MYACCOUNT" account and is called "MYDATA" :
Changing the Modulo of an Index
There are two ways to change the modulo of an index:
-
You can delete the index using DELETE-INDEX, and then recreate it using CREATE-INDEX. If you wish, you can specify the required modulo. Unless you specify otherwise (using the Z option) the index will be configured for automatic file sizing.
If you do not specify a modulo, CREATE-INDEX will automatically size the index based on the current item count and item sizes within the data file. Indexes built in this way will allow for 20% to 30% growth in index node structures. Allowing CREATE-INDEX to calculate the modulo is recommended where the index uses relatively straightforward index keys; that is, keys based on fairly short item attributes containing text or numeric data, or a concatenation of such attributes.
-
You can resize the index during a save and restore procedure by setting the reallocation parameters in attribute 13 of the file definition item. If a file has associated indexes, attribute 13 is a multivalued attribute, with the first multivalue containing the required modulo and separation of the file (see Using Reallocation Parameters). The remaining multivalues contain the same information for the indexes. You can find out which multivalue corresponds to which index by examining attribute 4, which contains the names of the indexes.
To resize an index in this way, set the corresponding multivalue in attribute 13 to the required modulo and separation (the separation must always be 1), and then carry out the save and restore procedure.
Notes:
- If you use OPTIMUM-MODULO to calculate the best modulo for a file, any indexes will be included in the calculation and the appropriate reallocation parameters set.
- When an index is restored from tape, it is converted to use automatic file sizing. Because of this, once an index has been resized in this way, it should be not be necessary to resize it again.