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 target field or command line.
Example:
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.
| Level |
Test Fields |
Features Checked |
| Minimum |
Test Primary Keys and Data |
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. |
|
Test BLOBs |
All BLOBs (fields for pictures – for example, on the item card) can be read. |
| Normal |
All the fields included in the Minimum test, plus: |
|
|
Test secondary keys |
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. |
|
Test space allocation |
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: |
|
|
Test relationships between primary and secondary keys
|
The connection between the primary and secondary keys is correct.
|
|
|
Test field relationships between tables
|
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.
|
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.
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.
What if an error occurs?
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:
- Export a Dynamics NAV backup copy of the database.
- Create a new database, and restore the backup into it.
- Run a Maximum test on the new database to check it.
- 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.
- If this does not work, contact your Microsoft Dynamics NAV 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.