File corruption can happen anytime, no matter how hard we try to prevent it. Fortunately, while it’s an inconvenience, it’s not normally a disaster and we’ll explore how to identify whether your file is corrupted, how to repair a corrupted file with FileMaker recovery tool.
Signs of A Corrupted File
If you are experiencing the following issues, chances are that your file may be corrupted:
- Repeated crashing of a FileMaker file
- Unexpected or unexplained behavior with the file
- If you have a habit of shutting down the server machine without properly closing down the files in FileMaker Server, then you should verify the corruption
- If your OS level backup software is backing up the hosted FileMaker files, they could get corrupted. Always clone your ‘backup copies’, not the hosted files located inside the FileMaker Server > Data > Databases
- If you are working within the Manage Database option on a hosted file and you can’t access the file while open, your file may be corrupted
- If the file size increases from one back up to the next without a valid reason, corruption may be the cause
How to Verify A Corrupted File?
Fortunately, FileMaker comes with a Recovery feature that allows you to identify if your file is safe to use or not. To verify a corrupted file, start with a recent backup of the file you think may be corrupted. Move this file to a non-server machine and don’t take up resources on the server machine. Make a clone, as it works well and makes the recovery faster, but it will not tell you if the corruption is in your data and not your schema.
Once completed, open FileMaker and from the menu select File > Recover. Select the compacted copy/clone and run the recovery. Check the consistency of the file first and then continue with the recovery process. Once the recovery process is complete, FileMaker will alert you if there were any issues found.
How to Repair a Corrupted File?
Once you identify a corrupted file, you have two options to repair it – Revert to a Backup or Perform Surgery.
1. Revert to a Backup
Run your recent backups through the recovery process until you find the most recent backup that passes the recovery check. Create a clone of the good backup and create a compact copy of the clone. Keep in mind, if there has been any code, or layout or schema changes in production since the last good backup, you will need to repeat those changes. Import data into the new file with the most recent data, and host your updated file as a replacement of your corrupted file.
2. Perform Surgery
Before starting with the repair process, save copies of the file as you go along. Create a new folder for each stage you are working and have the folder name be a very specific description of where you are in the surgery. For instance, your folders may look like – Good_Removed, Good_And_Morning_Removed, and so on.
A log file gets generated when you perform a recovery. You can look through this log file to get a little more detail on what has failed. The 2nd column in the FileMaker Recovery Tool is an error code column. For most of the rows, this will be a “0”. Keep looking until you find a non-zero number; this is where your corruption is. Look for the location of these errors, and identify if you can “perform surgery” to take it out.
Let’s say, if the log identifies it’s a specific layout, try deleting all the contents of that layout and running the recovery again, making backup copies of each step along the way. If it is a script, try deleting the contents of that script. If it’s a custom function, delete the contents of the custom function. If the recovery still fails, and the log says it’s failing at that script, then delete the item and run the recovery again. You can also look at your failed item and see if there’s anything complicated about it and then remove just that piece and run the recovery. For instance, if your layout is failing and you have a non-native icon or image, try deleting that first instead of deleting all the content.
Repeat the process until you’ve removed all failed items and your file passes a recovery check. You will then have to recreate those items you have modified or deleted. Ideally, do not cut and paste anything, recreate from scratch. If you think it’s the data that might be corrupted, try running recovery on a clone and see if it works. If you identify the data is corrupted, export the data as .merge files, but rename those files to have a .csv suffix.
How to Prevent Corruption?
To minimize file damage and prevent corruption, try to get a backup generator for your server machine in case there’s a power outage. This will avert unexpected shutdowns of your server machine without proper closing down of the files. Make sure your OS-level backup software on your server is not performing a backup of the hosted FileMaker file.
If you are working in Manage Database on a hosted file, try to be quick and avoid leaving Manage Database open while you leave your system idle. Backup your files as frequently as you can and try to keep your backups for as long as you can. When corruption happens, the more backup files you have to deal with, the better the options you will have.
If you have a lot of files that seem to get corrupted often, check them regularly. Set a reminder in your calendar if you need to. Compact and clone the file regularly or whenever you get the chance.
Meet the FileMaker Recovery Tool
Sadly, file corruption is inevitable, and it’s hard to avoid completely. However, with the correct use of the FileMaker Recovery Tool and a few preventive measures, you can greatly reduce the chances of file corruption and repair your corrupted files if issues do occur.
At Neo Code, we are a team of professional FileMaker developers and consultants, always on hand to help your company develop a custom-made workflow system for your unique business needs, helping you organize your projects and work. We also offer carefully tailored FileMaker training for your team. So don’t delay, get in touch with us today.