Recovery From Database Corruption
Question
My database has been corrupted. Is there any way to avoid losing my data?
Answer
This answer depends a great deal on the level of corruption, the type of backups you have, and how much information is still accessible from within your existing installation (as opposed to being in external files such as the static pages Movable Type has generated from the data).
Does your host maintain backups for your account?
If so, do they have any which would include copies of your database files prior to the time corruption appears to have occurred?
A host may be able to restore your site back to a point when it was still functional. While you are still facing the loss of any data you added beyond that restore point, this could be a worthwhile tradeoff for recovering the majority of it.
Without site backups, you are looking at starting fresh with a new Movable Type installation.
Can you still log into your current installation?
If you can still log in to your current installation, this can make it easier to transfer data to a new installation.
- Log in to Movable Type and perform an export.
Verify that the export contains all your data. With a corrupted database, it is possible that an export will be only partially successful.
- Copy out your templates into local files.
Or, if you've used the Link this template to a file feature before and are familiar with how it works, this can be an easier approach to saving your templates, because you can simply link new templates in the new installation to the files on your server rather than using copy and paste.
- Leave your existing installation in place until you have the new one up and running.
Retaining access for a period of time gives you a fallback in case your export/import doesn't work, you forget to back up a particular template, or you want to view your current settings while setting up the new installation.
If you are unable to log in to your installation at all, your primary form of recovery will involve relying on backups.
- Do you have any recent Movable Type export files?
If you've been performing regular exports, you can use the most recent one to import your entries and comments into a new installation.
If you do not have any recent exports, then you are facing the recreation of your entries by hand, assuming you still have access to the static files Movable Type generated on your server which contain each entry.
- Do you have any copies of your templates?
If you kept copies of your templates on your local computer, or if you used the Link this template to a file feature and the external files are still available on your server, this will help you recreate the templates in your new installation.
Set up the new installation
- Use MySQL.
Most corruptions occur with Berkeley databases, and most users who have faced corruption never want to experience it again. Choose MySQL this time - it's not only more stable, it's faster and gives you potential access to more Movable Type features such as Dynamic Publishing.
- Follow the normal installation instructions.
If your original installation is still accessible, remember to choose a different location for the new installation.
- Once you're able to log in to the new installation, begin recreating your first weblog.
If you can access your old installation, then do so in a separate browser window, and view each of the Settings tabs so you can duplicate each setting in your new weblog.
- Recreate any categories.
If you will be importing an export file, categories will be created automatically during the import process, so you can skip this step if you wish.
- Recreate your templates.
You'll either be creating new templates and pasting in your template code; or replacing the defaults with your versions for templates which already exist in the system.
- Recreate your entries.
If you have an import file, upload it in ASCII mode to a folder named
importin your new installation folder. Then use the Import menu to bring your entries into the system.If you do not have an import file, and you plan to recreate your entries by hand, this may be something you'll do over a period of time. But you can should at least create one or two entries to test the other work you've done thus far.
- Rebuild your site.
If you've been recreating your entries manually, this step is not necessary, as pages have been building whenever each entry was set to a status of PUBLISHED.


