O'Reilly Hacks
oreilly.comO'Reilly NetworkSafari BookshelfConferences Sign In/My Account | View Cart   
Book List Learning Lab PDFs O'Reilly Gear Newsletters Press Room Jobs  


 
Buy the book!
Windows Server Hacks
By Mitch Tulloch
March 2004
More Info

HACK
#55
Restore the Metabase
While it's simple to restore the metabase from a backup, what if you have no backup or can't open the GUI? Use this hack
[Discuss (0) | Link to this hack]

In , we explored several ways of backing up the metabase, including backing up the machine's System State information using the Backup utility, saving the configuration in Internet Services Manager with MetaEdit (a downloadable tool for IIS 5), and using the history feature of IIS 6.

Restoring the metabase from backup is equally straightforward. If you are recovering your machine from a disaster, the metabase is restored as part of the System State information you previously backed up, assuming you didn't change the default option of including System Protected Files in your backup. Alternately, if you're restoring the metabase on a working machine to recover a previous good IIS configuration, simply select the backup in the Configuration Backup/Restore dialog box and click Restore. Then, follow the prompts and wait as IIS stops, rebuilds, and restarts. Restoring the IIS 6 metabase from a history file is done in the same way: just select a history file in the Configuration Backup/Restore dialog box and click Restore.

Notice that the dialog box (refer back to ) displays both metabase backups stored in %SystemRoot%\System32\inetsrv\MetaBack and history files stored in %SystemRoot%\System32\inetsrv\History in one combined list. You can tell the difference between a history file and a backup file in this list by looking at the filenames: all history files are named Automatic Backup and are distinguished in the GUI only by their timestamp, while backup files you create are named whatever you decide to call them.

It all seems so simple, but what if your metabase becomes corrupt and you need to restore it from backup? If you can start Internet Services Manager, you can use the Configuration Backup/Restore dialog box as described earlier. But if the metabase is corrupted beyond the ability of IIS to repair it, Internet Services Manager might not even start, and then you're stuck. What do you do?

You could restore the entire System State of your machine from backup media. Unfortunately, that might have unpleasant side effects, especially if you're running IIS on a domain controller. For example, all those users and groups you created since the last backup will suddenly be gone (unless you have another domain controller to replicate the information). There might also be changes to the Registry that will be rolled back, and these changes might be harder to troubleshoot.

But there's a better way.

Manually Restoring a Backup in IIS 5

If you can't open Internet Services Manager, try replacing the metabase with its most recent backup.

First, stop all IIS services by typing net stop iisadmin /y at the command prompt (or use iisreset /stop if you prefer). Then, find the metabase.bin file in %Systemroot%\System32\inetsrv and rename it metabase.bad (keep it in case you need it later). Copy your backup file (it probably has the extension .MD0) from %Systemroot%\System32\inetsrv\MetaBack to %Systemroot%\System32\inetsrv and rename it metabase.bin. Now, restart the computer. You should once again have a working IIS configuration and be able to start Internet Services Manager.

By the by, instead of rebooting your machine, you can try to restart IIS services by typing iisreset /start from the command line. But in my experience, it's better to reboot your machine, because IIS is sometimes a little flakey after a restore like this.


O'Reilly Home | Privacy Policy

© 2007 O'Reilly Media, Inc.
Website: | Customer Service: | Book issues:

All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.