SharePoint bug: extending web application breaks the backup process

There appears to be a bug in SharePoint (WSS or MOSS) that breaks the backup process after extending a web application. If you need to add host headers or load balancing URL to your SharePoint web application, the only way to do that is to extend your web application (SharePoint Central Administration >> Application Management >> Create or extend Web application >> Extend an existing Web application). Even though extending web application allows you to add load balancing URL and host headers, for some reason, it breaks the backup for all site collections and sites that use that web application. You could still backup SharePoint site collection using stsadm.exe command (stsadm.exe –o backup –url http://damagedWebApp/ -filename backup_damaged_webapp.bak), but built-in SharePoint backup through Central Administration wouldn't work. You will start receiving an error (Error: Object SharePoint - 80 failed in event OnPrepareBackup. For more information, see the error log located in the backup directory. KeyNotFoundException: The given key was not present in the dictionary) every time you attempt to backup modified web application using Central Administration website.

To get backup process working again you will have to perform the following steps:

  1. Backup your web application database through Microsoft SQL Server Management Studio!!!
  2. Detach the content database from the web application:
    1. Go to SharePoint Central Administration >> Application Management >> Content Databases
    2. Make sure to select damaged web application form the drop down list, otherwise you will messing with the wrong web application
    3. Click on the content database used by damaged web application
    4. Check "Remove content database" and click OK (ignore the warning). Removing the content database does not delete the database; it only removes the association of the database with the Web application. This action is analogous to detaching a database in SQL Server in that the content of the database remains intact.
  3. Delete the web application (remove SharePoint from it):
    1. Go to SharePoint Central Administration >> Application Management >> Delete Web Application
    2. Make sure to select damaged web application form the drop down list
    3. Leave "Delete Content Databases" and "Delete IIS Websites" options set to "No". You can always remove them later, right now we are only interested in removing SharePoint references to the damaged web application
  4. Create a new web application with the appropriate settings for host header, load balancing URL and so on:
    1. Go to SharePoint Central Administration >> Application Management >> Create or extend Web application >> Create new Web application
    2. Configure new web application settings. Don't forget host headers, new website and port settings, and load balancing URL (as needed) and click OK
  5. Remove content database of the newly created web application by running
    stsadm.exe -o deletecontentdb -url http://newwebapplication:port -databasename NEW_WEBAPP_DB
    Go to http://technet.microsoft.com/en-us/library/cc262449.aspx for more information on deletecontentdb operation of stsadm.exe command
  6. Attach the existing database to the new web application by running
    stsadm.exe -o addcontentdb -url http://newwebapplication:port -databasename OLD_WEBAPP_DB
    Go to http://technet.microsoft.com/en-us/library/cc263422.aspx for more information on addcontentdb operation of stsadm.exe command
  7. Make sure that host headers in IIS as well as Alternate Access Mapping is set properly and try running the full SharePoint backup again through Central Administration.

After those steps you will probably also have to configure search server setting for your content database (SharePoint Central Administration >> Application Management >> Content Databases >> Select Search Server from drop-down list) and get full crawl running to make sure that your search is up-to-date and working properly.

Now that your backup is running again, it should safe to remove:

  • the database that was created with new web application (see Step 5 above)
  • the website used by damaged web application (assuming you don't need this website for anything else)

 



Related resources: