File Maintenance and Recovery
A corrupted database system is every developer's nightmare, as well as every user's. Database systems are complex, and very sensitive to the integrity of their data structures. Errors in the way data is written to a database can damage a system, or in the worst case render it unusable. Periodic maintenance can help you avoid file structure problems. In the worst case, if one of your files does become corrupted, FileMaker has tools to help you recover from this situation as well.
File Maintenance
As you work with a database file, the file can become slowly more fragmented and less efficient over time. Large deletions can leave "holes" in the file's data space. Heavy transaction loads can cause indexes to become fragmented. If your databases are large or heavily used, it's a good idea to perform periodic file maintenance.
The File Maintenance feature is available only in FileMaker Pro 8 Advanced (formerly FileMaker Developer). File maintenance can be performed only on files that are open locally. It can't be performed on files that are hosted. To invoke it, choose Tools, File Maintenance. You'll see a dialog like the one in Figure 17.13, which allows you to choose to compact the file, optimize the file, or both. We recommend you execute both of these steps when performing file maintenance.
Figure 17.13. Periodic file maintenance (a feature of FileMaker Advanced) is a good idea if your files are large or heavily used.
There isn't a firm rule of thumb for when and how often to perform file maintenance. A general rule might be that if you have a database file of more than 2030 megabytes in size, or that is changed hundreds of times daily, it might be wise to perform a file maintenance every few months. If your file sizes rise into the hundreds of megabytes, or your activity rises into the thousands of records changed daily, you may want to perform maintenance monthly, or even more frequently.
File Recovery
It might occasionally happen that a FileMaker file becomes so badly damaged it cannot be opened. When this happens it's usually because the file's host (either the FileMaker client or the FileMaker Server) suffered a crash. If a file is damaged in this way, it's necessary to use the File, Recover command available in any copy of FileMaker Pro. This command tries to rebuild the file and repair the damage in such a way that the file can again be opened and its data accessed. The recovery process can take from a few seconds to many minutes or occasionally hours, depending on the size of the file and how many indexes it contains.
With previous versions of FileMaker, the recovery process was not intended to repair a damaged file fully. In the past it was necessary to issue extremely strong warnings, to the effect that files that have been damaged badly enough to require recovery should not be put back into service. Previously, the recovery process was intended primarily to bring the file back to a state in which the data could be moved into a clean copy of the file. You needed to create that clean copy by taking a recent backup (you do have a backup, don't you?) of the file, opening it, and choosing File, Save A Copy As, choosing to save it as Clone (No Records). This creates an empty copy of the file, containing all the structural elements such as table definitions, scripts, layouts, and the like. From there, you could run an import to fetch in the data from the recovered file.
Things have changed a bit with the FileMaker 8 product line. In the past, there were really no reliable tools to tell you when a FileMaker database might contain some form of corruption. If you even suspected your database of corruption (and needing to recover a file was taken as reasonable evidence of corruption), it was deemed better to recover the data and rebuild or restore the structure. |
FileMaker has always performed a consistency check on files it suspects of having something wrong with them. The consistency checker built in to FileMaker Server 8 is more thorough and aggressive than previous versions, and it's now our understanding that any file that passes FileMaker Server 8's consistency check can be considered safe to use. Nonetheless, old habits die hard, and we do advocate a bit of caution until the new tools are more completely field tested.
Caution
Although we're excited at the prospect of better consistency checking and recovery tools in FileMaker 8, we recommend you continue to use caution in working with files that have been recovered.