How to Repair the Database

 

This Topic does not apply to the Enterprise Version of Crimestar RMS. The Enterprise Version of Crimestar RMS utilizes a much more robust and high performance SQL database and does not require this action to be performed.

 

Occasionally database tables can become corrupted or invalid as a result of a system crash or potentially by accessing and updating a table from a program other than CrimeStar. Sometimes this can occur if CrimeStar has the database tables open and the program terminates abnormally either due to an internal error or the computer being rebooted or otherwise shut-off without first exiting CrimeStar normally. This can also be the case when running in a network environment and the server crashes or reboots while your workstation is accessing the CrimeStar database tables. When database tables become invalid you can often repair them by using the built-in Repair utility.

 

Automatic Safeguard Reminder: As mentioned above one common problem is the computer being turned off without CrimeStar and other applications being properly shutdown. To alert you of this circumstance CrimeStar uses a semaphore file to flag when the potential for a problem may have occurred. When you start CrimeStar it looks for and then creates a file named repair.zzz in the default CrimeStar directory. When CrimeStar is properly shutdown this file is deleted by CrimeStar. If this file is found by CrimeStar when the program starts then CrimeStar knows that the program was not properly shut-down the last time it was run. It then provides the user with a message indicating the possibility of file damage, and it offers to let the user run the repair utility. DO NOT BE ALARMED if you see this message, on the other hand do not consider it to be meaningless. The display of this message does not indicate that your data files are damaged, it only indicates that a condition or improper shut-down has occurred and that the possibility exists for damage to have occurred. (You will always receive this warning when more than one copy of CrimeStar is running on a single machine, as subsequent copies of the program will find the repair.zzz file created by the first copy run) It may take a while to run the repair utility, but it wont hurt your database to run the utility even if the files are not damaged.

 

If you are not sure what to do, backup your data files to a different directory or new backup tape and run the repair utility.

 

The repair utility can not correct all corruption problems, however it is very effective on the most common problems, which invalidate database tables.

 

The most common corruption problem involves invalid header information. The header (first part of a table) contains information about the number and type of fields and the number of records that the table contains. For Example: when a new record is added two things must happen. CrimeStar adds the record to the table and updates the table header to reflect the new record count. During this operation there is a brief window where problems can occur. If the workstation machine performing the add/update operation is powered off (either by the user, or due to a power failure) it is possible for one or the other but not both of these operations to occur causing the table and its header record to fall out of synchronization.

 

This is a classic example of table corruption that our built-in repair utility can fix. Remember your best protection against loss of data is a good backup procedure. If you dont have a tape backup - get one !

 

To Repair a CrimeStar database you must have Administrator security access.

 

Select System from the main menu. Then select Repair Database from the System menu. You will always receive a reminder warning that you must have exclusive access to the database tables. The Repair Form will then be displayed. Select the table(s) you wish to repair from the list of tables on the left side of the form. Then click on the button labeled Repair. The repair process will begin, and you will be notified when it is complete.

 

Remember the Repair process rebuilds the existing tables. This process may take a while to complete, and as always with database structural operations a backup should always be performed first. In this circumstance you should perform a backup, however you should also realize that the backup you are making likely contains a corrupt table. Please be sure not to overwrite a GOOD backup with a BAD one. We are only making a backup at this point in case something goes drastically wrong, at least we can get back to where we were, when we started. If you feel a bit nervous here, this would be a good time to call or e-mail Technical Support.

 

Steps to Perform a Repair:

 

Step 1. Find your last good backup tape and set it in a safe place.

Step 2. Have everyone exit from CrimeStar so that all data base files are closed.

Step 3. Using another tape or external media make a backup of the CrimeStar data directory.

Step 4. Start CrimeStar and run the repair utility from the System menu.

Step 5. Check the program to ensure that the repair was successful.

Step 6. If not successful, contact Crimestar Corporation for Technical Support

 


See Also: How to Pack the Database

How to Reindex the Database