Reindex files and rebuild relations
Files Maintenance in alameen ERP 10 has two wizards that rebuild the structure of the file's database without changing your data. Reindex Files rebuilds the indexes that speed up searching. Reconstruct Tables Relations creates the relations between the tables of the file again. Each is a single page with a Start button. For the practical steps see Reindex files and Reconstruct tables relations.
Opening the windows
- Click File > Tools > Files Maintenance, select Reindex Files or Reconstruct Tables Relations, and click Run. The Files Maintenance window opens after the program closes the open windows and reserves the file for you alone.
- Both items show in the list when your key includes accounting, a file is open, and the file does not work in multi-file mode (Available maintenance). The program checks no permission of its own for each when you run it from the window; the Files Maintenance permission guards the window. The desktop tile of each shows only for a user who has a permission of the same name on the Operations page of Users Management.
- The wizards also start from the favorites menu on the Tools page, from Quick Launch search and from a Maintenance tile on the desktop; these routes check no permission of the operation either.
- The description under the item reads: "Files consist of data and indexes. The indexes don't contain any information other than those in the original files, but they can greatly speed search operations and data access. This operation rebuilds files index." for reindexing, and "This operation will reconstruct the relations between database tables." for the relations.
- Reconstruct Tables Relations shows in the list inside the warning frame "This operation is dangerous …". Reindex Files is the least serious maintenance and shows without the frame.
- Reindexing also starts from outside this page. From the recent files list it opens the indexing page of the login window, and runs a normal indexing without the two options. From the file reindexing step of a scheduled task it runs the quick indexing.
Neither wizard shows a backup page before it runs. Take a backup before you start, and see Make a backup and When to use files maintenance.
What both wizards share
Each wizard is one page. At the top is a title band with the name of the maintenance, then a warning that the operation may take long, then an instruction line. Under them is a line where the program writes the current stage, and a progress bar. The progress bar stays hidden until you click Start. When to use files maintenance explains how the wizards work in general. The buttons of both pages:
| Button | What it does |
|---|---|
| Start | Starts the operation at once, with no confirmation question. It is disabled while the operation runs. |
| Cancel | Asks "Are you sure you want to exit and cancel the maintenance operation?". Yes closes the wizard with no change and No keeps you on the page. During the run it works in Reindex Files and does not work in Reconstruct Tables Relations (see the next two sections). |
| Next and Back | Both are disabled, because the wizard is one page. |
| Help | Opens the help topic of the page when one is available. |
On success the message "Operation successfully completed" appears, the wizard closes and you return to the Files Maintenance window. On failure the message "An error was encountered while performing the operation." appears and the wizard stays open so that you can try again.
Reindex Files
A database index works like the index of a book: it adds no new information, but it speeds up searching. This page rebuilds the indexes. It does not change your bills, vouchers or balances.
The window title and band read "Reindex Files". The page shows a notice: "The operation may take a long time depending on the size of files. Please do NOT turn off the computer while this operation is in progress." and the instruction: "Click "Start" to begin re-indexing files."
| Field | Description | Required | Values and rules |
|---|---|---|---|
| Quick Archive | Rebuilds only the fragmented indexes instead of rebuilding all of them. | No | Not ticked when the page opens. If the file is a publisher or a subscriber in the replication system, it is ticked and disabled and you cannot clear it. |
| Recreate Default Values | After the indexing succeeds, sets the default values of the fields of the file's tables again. | No | Not ticked when the page opens. |
In the Arabic interface the first option is named «فهرسة سريعة».
What each method changes
Normal indexing (Quick Archive not ticked) runs in this order. The stage line shows "Reindex Files" while it runs.
- It deletes the existing relations between the tables of the file.
- For each table it deletes the indexes, then builds the primary key and the other indexes again as the program defines them.
- It creates the relations that the program defines for the file. In the usual setup this is a limited set of relations, so not every relation between tables comes back.
- It clears the mark "the file needs reindexing" if it was set.
- It recreates the rule that prevents duplicate barcodes in material cards. It prevents a repeated barcode on its own when the option Prevent duplicating barcodes on the Save page is on, and otherwise prevents only a repeat on the same material.
Normal indexing does not run in a single transaction. If it stops with an error, some indexes or relations may stay unbuilt, so run it again until it succeeds.
Quick indexing examines all the indexes of the file and treats only those whose fragmentation is over 20 percent. It reorganizes an index whose fragmentation is between 20 and 40 percent, and rebuilds one whose fragmentation is over 40 percent. It does not delete relations or rebuild healthy indexes, so it is faster and suits regular maintenance. It is the method that the file reindexing step of a scheduled task runs.
When Recreate Default Values is ticked, the stage line shows "Create Default Values" after either method succeeds. The program then recreates the default values of the table fields and resets a default value that belongs to the replication system.
While it runs
- Cancel works during the run. If you click it and answer Yes, the program disables the button but does not stop the operation: it completes and "Operation successfully completed" appears.
- The progress bar moves by the number of command batches the program runs. It does not show the percentage of time done.
- If normal indexing fails with an error from SQL Server, the error message appears first, then "An error was encountered while performing the operation.".
Reconstruct Tables Relations
The program links the tables of the file with relations that prevent, for example, a record from pointing to a record that does not exist. This page creates these relations again.
The window title reads "Reconstruct Tables Relations". The page shows the same notice, "The operation may take a long time depending on the size of files. Please do NOT turn off the computer while this operation is in progress.", and the instruction "Click "Start" to begin the process of Reconstructing Tables Relations.". It has no fields.
When you click Start:
- The program deletes all the existing relations between the tables of the file.
- It creates the relations that it defines for the file and writes "Create External Keys" in the stage line. In the usual setup this is a limited set of relations.
- The deletion and the creation run in one transaction: if either fails, all the changes are cancelled and the relations stay as they were.
Cancel is disabled during the run, so you cannot stop the operation. The progress bar does not show the percentage done.
On failure the error message from SQL Server appears first, if there is one, then "An error has occurred while rebuilding the relations".
Messages
| Message | Why it appears | What to do |
|---|---|---|
| Are you sure you want to exit and cancel the maintenance operation? | You clicked Cancel. | Yes closes the wizard. In Reindex Files during the run it does not stop the operation. |
| Operation successfully completed | The operation finished. | Click OK. |
| An error was encountered while performing the operation. | Indexing or rebuilding relations failed. | Read the SQL Server message that came before it, if any, and try again after the other users leave. If it repeats, contact technical support. |
| An error has occurred while rebuilding the relations | Reconstruct Tables Relations failed. All its changes are cancelled. | Check that nobody else is working on the file and try again. |
Related
This page applies to alameen ERP 10, version 10.1.79.764.