User Menu

Downloads

Client Login

 

Quick Search


Who's Online

Home arrow Support arrow Knowledgebase arrow Database Corruption and What To Do About It
Loading...

Database Corruption and What To Do About It

What is database corruption?

Many of our programs utilise industry-standard Microsoft Access databases to store their data. The Microsoft Access Jet database engine is used to connect to these databases from within programs. Inherent design characteristics of the Jet database engine mean that, occasionally, database corruption may occur.

Corruption of the database means that the data contained in the database can no longer be accessed by programs, as it is no longer in a format that is recognized. Most often, this is not a problem with the actual data, rather with settings within the database. On rare occasions however it can mean that data may be lost, or may require specialized (and expensive!) assistance to be recovered. For this reason you must ensure you always have good, recent backups of your data.

Database corruption will often only be discovered when you get one of the following error messages when trying to run a program:

  • Error 3343: Unrecognized database format .
  • Error 3218: Couldn't update; currently locked.
  • Error 3045: Couldn't use ; file already in use.
  • Error 3197: The Microsoft Jet database engine stopped the process because you and another user are attempting to change the same data at the same time.

 

Why Does Database Corruption Occur?

The following is an edited excerpt, taken from the Microsoft knowledge base article found at http://support.microsoft.com/kb/109953/EN-US/.

 

There are three main causes of corruption in Access/Jet mdb files:

  1. Database is Suspect/Corrupted Due to Interrupted Write Operation

    Proper shut down, by clicking Exit or Close on the File menu, is highly recommended. However, if a database is open and writing data when the program is abnormally shut down, the Jet database engine may mark the file as suspect/corrupted. This can happen if the computer is manually turned off without first shutting down Windows or if power is lost. Other situations may not shut down Access but may still interfere with Jet's writing of data to the disk while the database is open. This can happen, for instance when networks experience data collisions or disk drives malfunction. If any of these interruptions occur, then Jet may mark the database as potentially corrupted.

    When Jet begins a write operation, it sets a flag, and resets the flag when the operation is complete. If a write operation is interrupted, the flag remains set. When you try to open that database again, Jet determines that the flag is set and reports that the database is corrupt. In most cases, the data in the database is not actually corrupt, but the set flag alerts Jet that corruption may have occurred. In cases such as this, compacting and/or repairing the database can typically restore the database.

  2. Faulty Networking Hardware

    In this case, the file corruption does not involve the Jet Engine; rather the file is literally corrupted by some outside cause. The cause can be one or more links in the hardware chain between the computer that the database resides on, and the computer that has the database open. This list includes, but is not limited to, network interface cards, network cabling, routers, and hubs.

    Hardware based corruption is typically indicated by mdb files that cannot be restored through the use of compacting, repairing, or Jetcomp. Hardware corruption will typically recur until the responsible hardware is repaired or replaced.

  3. Opening and Saving the .mdb File in Another Program

    There is no way to recover an .mdb file that was opened and then saved in a different program. For instance, Microsoft Word will allow you to open an Access database and then save it. (By the way, it does not serve any purpose if you open a .mdb file in another application since all you see are extended characters.) Saving it this way will cause the mdb file to prompt you for a database password when trying to open it in Access - even though the file may have never been password-protected in Access. The password prompt occurs in such cases because the first byte range Access checks when opening a file is where the database password would be. If that byte contains corrupt data, Access treats the file as being password protected. Even if there were a way to get around the password prompt in this case, the database would still be unrecoverable because the binary structure is scrambled and thus unreadable to Access. Recovering a backup copy of the file is the only solution in this case.

 

How to Repair a Corrupted Database

Note that the discussion that follows assumes you are attempting to repair a Jet database used by a current version of a CDA Software program. All our current program versions use the Access 2000 database format. Older versions, and databases used by other programs, may use different database formats or Access versions and if that is your situation, or you are unsure, you should contact the supplier of your program for assistance.

Do not attempt to repair a database without making a backup copy of the corrupted file, in case you make the situation worse.

CDA Support staff will attempt to repair corrupted databases for our clients (charges apply). We have developed an additional tool that can in some cases completely rebuild a corrupted database, recovering as much data as possible. However you may like to try one or both of the following two easier methods first:

  1. Repairing a database using Microsoft Access 2000 or Later:

    If you have Microsoft Access 2000 or later installed on a computer on your network, you can open your database using this program. Note: Earlier versions of Microsoft Access will not work. In most cases, Access will automatically offer to repair the database when you attempt to open it. If it does not, you can initiate a repair by clicking on the Tools menu, then selecting Database Utilities. From the sub-menu, select Compact and Repair Database. This will begin the database repair process. If it is successful, a message will appear saying "Successfully repaired the database".

  2. Repairing a database using JetComp:

    If you do not have Microsoft Access 2000 or later, an alternative method of database repair is to use JetComp (Jet Database Compact Utility). To start JetComp, click on your Start menu, and go to Run.... In the Open text box, type jetcomp and then click OK. If the program is installed, a window will appear titled "Database Compact Utility". Using the Browse button (...) next to the Database to Compact From (Source) field, select the database that you wish to repair. In the Database to Compact To (Destination) field, enter a new name for your repaired database. A good idea is to copy the source path and simply append "repaired" to the name (eg. "test.mdb" becomes "test repaired.mdb"). Clicking the Compact button will begin the process. A status bar across the bottom of the program window lets you follow the progress. When the program finishes, click Exit. Depending on the program you wish to use the database with you may need to rename the newly repaired database to use it without making other changes (eg "test.mdb becomes "test old.mdb" and "test repaired.mdb" becomes "test.mdb"). This can be done from My Computer or Windows Explorer by right-clicking on the database file and selecting Rename.

 

How to Prevent Corruption

There is no guaranteed way of preventing database corruption. You can, however, minimise the chance of data loss by having in place a good backup strategy. CDA Software recommends and is an authorised reseller of the Datagard secure online backup service. For more information, see the Related item on Backup.


Article Id: 9 - Version: 8 - Created: 25-09-2007 - Last Updated: 02-09-2008 - Hits: 3763 
Categories: General