In the past I have seen the following problem a couple of times: a customer creates a backup of a content database on one server farm (e.g. using STSADM -o backup or a DB backup in SQL) and restores the backup on a different farm and attaches the content database to a web application.
After this operation is done several operations (like variations and content deployment) fail to work with the following exception:
System.ArgumentException. Value does not fall within the expected range.
at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)
at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)
at Microsoft.SharePoint.SPWeb.GetMetadataForUrl(String relUrl, Int32 mondoProcHint, Guid& listId, Int32& itemId, Int32& typeOfObject, Object& fileOrFolder)
at Microsoft.SharePoint.SPWeb.GetFileOrFolderObject(String strUrl)
at Microsoft.SharePoint.Publishing.CommonUtilities.GetFileFromUrl(String url, SPWeb web)
The reason for this problem is that backup/restore does not adjust the references from the publishing page objects in the Pages library to their Page Layouts. These URLs are sometimes stored as absolute URLs including the server name. And this server name is the server name of the old server farm which cannot be resolved on the new farm.
Be aware that backup/restore of MOSS content databases between server farms are not fully supported! Official documentation of this support limitation is currently in the works. The supported way to transfer content between server farms is to use STSADM -o export/import or content deployment. Backup/restore is only supported for the same server farm.
In case that you have run into the above problem you have two options:
- Throw away the database and transfer it correctly using STSADM -o export/import or content deployment
- Fix the incorrect links manually using the following steps
- Open the web in SharePoint Designer
- On the “task panes” window, pick hyperlinks.
- For the “hyperlink” heading, click the arrow and pick (custom…)
- In the dialog, ask to show rows where the hyperlink begins with a URLs which are not valid on the current server farm
- For each of the files, right click and say “Edit hyperlink…” and Replace hyperlink with the hyper link that is valid on the current server farm.
I have written a tool to automatically perform this fix: FixPageLayout
[Update from 2009-05-01] Microsoft has now released a hotfix to support backup/restore between different farms for publishing sites. See here for details.