Recipe 12.16. Backing Up and Restoring the MetabaseProblemYou want to back up or restore the metabase. You may need to restore it if the metabase becomes corrupt or your server bites the dust. SolutionUsing a graphical user interfaceTo back up the metabase, do the following:
To restore a previously backed up metabase configuration, do the following:
To restore the metabase from a metabase history (automatic backup) file, do the following:
To restore the metabase to its initial configuration when IIS was installed, do the following:
Using a command-line interfaceThe following command backs up the metabase using the iisback.vbs script and names the two backup files 28july04.MD0 (for MetaBase.xml) and 28july04.SD0 (for MBSchema.xml): > iisback /backup /b 28july04 To view a list of the current metabase backups, use the following command: > iisback /list If you create another backup with the same name as the previous one, the version number will be incremented by one. To overwrite version 0 of the backup instead and create a new backup, do the following: > iisback /backup /b 28july04 /v 0 /overwrite The following command restores the password-protected backup named My Metabase Backup: > iisback /restore /b "My Metabase Backup" /e <password> Using VBScriptFor a good example script on how to backup and restore the metabase, see the code for iisback.vbs in the IIS 6 Resource Kit. DiscussionTable 12-7 lists the three kinds of metabase backups. The Subfolder column contains the subfolders under %SystemRoot%\system32\inetsrv in which the backup is stored.
Whenever the metabase is backed up, both the metabase configuration file (MetaBase.xml) and metabase schema (MBSchema.xml) are backed up. The automatically generated initial backups are named as follows:
History files are named using major and minor version numbers as follows:
For example:
The major version number is incremented when you:
The minor version number increments after you've enabled edit-while-running (see Recipe 12.15), manually edited the metabase configuration file (%SystemRoot%\system32\inetsrv\MetaBase.xml), and saved the changes. If the major version number is incremented, the minor version number is reset to zero. Manually created backup files are named according to the name you assign, for example:
If you create a second backup the same day, the new files would be named:
Regularly creating password-protected metabase backups is a good idea for two reasons:
If you had an SSL-enabled web site on your crashed computer, however, you'll need to install your server certificate on your new computer and restart IIS on the new computer. See AlsoRecipe 12.15 and MS KB 324277 (How To Create a Metabase Backup by Using IIS 6.0 in Windows Server 2003) |