Main BASIS Page
Main Advantage Page
This Issue's Table of Contents


Everybody's Worst Nightmare- File Corruption


By Teresa Dominguez
Summit Electric and Smart Data Management Table of Contents SQL and BASIS products...It's All About Data

ERROR=7 and "core dumps" are some of the most difficult problems we face in helping BASIS customers because these problems are almost always caused by file corruption. We know that silent pause all too well when we ask, "Do you have a recent backup?"

More often than not, what we see when we look at the backup is that there are indications that files were already damaged. When files are scanned, we find key data with no record or record data with no key. This tells us that there are data corruption issues going on at this site that need to be investigated.

Indications of file corruption include periodic occurrences of ERROR=7, ERROR=0 or ERROR=11 that seem to come and go. Sometimes even a read operation that takes a relatively long time to return can be an indication of file corruption. Understand, it's not that everytime you see these errors, you will have a corrupted file. It is only when you have an unusual increase of these types of errors during a short period of time that you should take a look at the file and make sure it's clean.

  HOW TO DETERMINE IF YOU HAVE A CORRUPTED FILE

The BASIS utility sets include file-recover utilities: the original recover utility, _fix , and the new mrebuild . We recommend using mrebuild over _fix because it has many more features and is easier to use. With these tools, you can scan your files and determine if you have lost records or have keys with no record and records with no keys. These utilities also give you the option to try to rebuild a corrupted file. Not everyone should run out and scan his or her files. But if you suspect you have a problem, the job is best done by someone with intimate knowledge of the files themselves, someone with an in-depth understanding of the key structure and contents.

The utility mrebuild is the easiest tool to use for MKEYED files because it can do so many things. It can, of course, scan and rebuild a corrupt file, but it does this as a standalone utility in single-user mode, so it is much faster than _fix . It can also read the file from one location and store the rebuilt file in another location. It can recover all the MKEYED file types from 2-GB, 4-GB and 64-bit files, and highly recoverable file types, depending upon your environment and BASIS product.

Once you have determined that you have a corrupted file either by crashing into that ERROR=7 or core dump or GPF wall, what do you need to do next?

  REBUILDING

If you have a recent reliable backup, the quickest way to get up and running is to restore from the backup, update or repost the missing data and you are back in business. But is your backup reliable? You can use the mrebuild utility to scan the backup to assure data integrity.

If you do not have a backup, you will need to actually fix the corrupted file again using the mrebuild utility. Once you have followed the process for the tool you use, you need to make sure the data in the file is correct and also restore any lost data.

  CAUSES AND PREVENTION OF DATA CORRUPTION

You might then ask what caused the corruption and how can I prevent it in the future? A common cause is, of course, power fluctuations, which can play havoc with your computer equipment. A good UPS (Uninterruptible Power Supply) can save you from more than just file damage; it can save you from damaged hardware such as disk drives, video cards, etc.

Another cause of file corruption at many sites is an impatient user. Many people have a tendency to reboot a computer that seems to take too long to accomplish a task. User training works to prevent this and so does implementing lock files for each terminal alias. The following Online Knowledge Base article addresses this issue:

http://www.basis.com/techsupport/kb/kb00109.html

Hardware problems, such as a failing disk controller or faulty memory, can also sometimes be culprits of file corruption. Adding a UPS, user training and periodic system maintenance and testing will certainly minimize problems. Frequent backups with a reliable backup/restore tool are the best protection.

  MAKING RECOVERY EASIER AND FASTER

Once you've fixed the files and addressed the cause of the file corruption, now is the time to look at how to make this process easier if it ever occurs again. The tool that BASIS provides for this is the highly recoverable file type, available in Feature Release 2.10 and later.

Converting existing data files to highly recoverable files is easy with the mrebuild utility. You will need extra disk space to convert because the process makes a new file and copies the records with a tag and checksum for each record. You may notice a slight speed difference in the new file type because it checks each record during the read operation for the checksum to assure that the record is not damaged.

  CREATING A HIGHLY RECOVERABLE FILE

To create a highly recoverable file, set the SETOPTS byte 7 bit $20$. We suggest that before you convert an existing file to be highly recoverable, you scan the file with mrebuild utility to verify the integrity of the data before converting the file.

  WHY USE HIGHLY RECOVERABLE FILES?

File corruption is an unpleasant problem to deal with because before the BASIS highly recoverable file option, fixing the file was only half the problem. Determining if the data was intact and complete was a very time-consuming process. BASIS has made it much easier to deal with if you choose to implement our highly recoverable file type. Using highly recoverable files, you know that only complete records were recovered. Your work is easier because you only need to determine if the transaction information is complete because you know the records themselves are correct.

 

 
Summit Electric and Smart Data Management Table of Contents SQL and BASIS Products...It's All About Data

Subscribe to The BASIS Advantage Magazine!

 
 
Copyright 2000, BASIS International Ltd. All rights reserved.
Terms of Use
.