To safeguard against errors, you should frequently check the integrity and consistency of your database. You do this from clients or single users.
Without opening the
program You can also test the database without opening the program. You start the test by
setting the program property DB Test in the Start in field (see page 54). Here is an example:
d:\Microsoft Dynamics NAV\CSIDE Client for Microsoft Dynamics NAV\fin.exe servername=My Server, ntauthentication=yes, database=database.fdb, dbtest=normal
The possible settings for DB Test in the Target field are min., max. and normal. You can customize the database test if you start the test from within Dynamics NAV.
From within the
program To start the test from within the program, click File, Database, Test. The Test Database window appears:
You determine the extent of the test by selecting one of the four option buttons at the top of the window (such as Minimum). When you select an option, the individual tests included in that option are run.
The following table lists what the different tests involve:
Level Test Fields Features Checked
Minimum Test primary keys and data
Test BLOBs
All records in all tables can be read.
Records are sorted in ascending order according to the primary key.
All fields are correct in relation to the field type.
All BLOBs (fields for pictures – for example, on the item card) can be read. You can read about BLOBs in the Introduction manual and the Application Designer’s Guide.
Primary and secondary keys, mentioned in the previous table, are sometimes described as indexes and are used, for example, when you sort information. The keys determine how information in a table is ordered. You switch keys to sort information in a table in a different way. For example, you might want to sort your customers by name or by number. See the Application Designer’s Guide manual for more information about sorting. For a more detailed description of keys, see page 89.
How often you need to test the database depends on how secure the rest of the system (including the network) is and what level of security you need. It is a good idea, however, to test before you make a backup – especially if you don’t use the Dynamics NAV backup function.
Note
Test space allocation cannot be executed when there is more than one user on the system. If you select a test that includes it, Test space allocation will not be executed if there are other users on the system, but the rest of the test will be executed normally.
Normal All the fields included in the Minimum test, plus:
Test secondary keys
Test space allocation
All secondary keys in all tables can be read.
Sorting is done correctly according to the secondary key.
All fields in the sorting have the correct field type.
All space in the database is either used by a sorting key or is available.
Maximum All the fields included in the Normal test, plus:
The connection between the primary and secondary keys is correct.
All fields that have relationships to other fields can be accessed from the field to which they are related.
Custom The same fields as in the Maximum test, but you can cancel the ones you don’t want to run.
Whatever you select.
Level Test Fields Features Checked
Click the Options tab to specify how the output from the database test is managed:
The output from the database test consist of the errors messages that are generated during the test. These can be handled as follows:
If you select Event Log or File the database test is not interrupted and will not take so long. You can then review any error messages that were generated and repair the things that caused them.
While the test is being performed, the following status window is displayed:
If an error occurs, the program stops and displays an error message indicating what the error is and where it occurs.
The following steps must then be taken:
1 Export a Dynamics NAV backup copy of the database.
2 Create a new database, and restore the backup into it.
3 Run a Maximum test on the new database to check it.
Option Means
Screen The error messages are displayed on the screen. Each time an error message is displayed you must click OK before the test continues. This can be quite troublesome if the test generates a large number of messages.
Event Log The error messages are written in the operating system’s event log. For more information about the event log, see the operating system’s documentation.
File The error messages are written to a text file. Use the AssistButton to specify the name and location of the text file.
4 If it is error-free, check to make sure that the company data is correct. Afterwards, you can continue to work in the new database.
5 If this does not work, contact your Microsoft Certified Business Solutions Partner for help.
Warning
Never delete a corrupted database (one that contains an error) before a new, tested database has functioned without errors for a period of time.
It is important that you remember to make backups – and make sure that they can be restored. You can read more about backups in the chapter called "Making Backups" on page 129.