Stefan Goßner

Senior Escalation Engineer for SharePoint (WSS, SPS, MOSS, SP2010) and MCMS

Common error situation when using backup/restore to transfer a database to a new farm on MOSS 2007

Common error situation when using backup/restore to transfer a database to a new farm on MOSS 2007

  • Comments 48
  • Likes

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:

  1. Throw away the database and transfer it correctly using STSADM -o export/import or content deployment
  2. Fix the incorrect links manually using the following steps
    1. Open the web in SharePoint Designer
    2. On the “task panes” window, pick hyperlinks.
    3. For the “hyperlink” heading, click the arrow and pick (custom…)
    4. In the dialog, ask to show rows where the hyperlink begins with a URLs which are not valid on the current server farm
    5. 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.

Comments
  • PingBack from http://stevepietrekweblog.wordpress.com/2008/03/13/links-3132008/

  • Hi Stefan,

    Why haven't you written this post 6 months ago :) We’re experiencing so many problems that might be linked to this!!

    Regards

    Emmanuel

  • To move application between server farms, should we use backup/restore or export/import?

  • Hi Thomas,

    You need to use export/import.

    Cheers,

    Stefan

  • Stefan,

    I created a prototype site for a client on my MOSS 2007 server. Didn't use any MOSS features.  Backed it up (on my server) and he is restoring it on his WSS server; but now he's getting this error:

    An error occurred during the processing of . Could not load file or assembly 'Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified. "

    Do you think i should have used export/import or should I go into the master page and remove references... or what??

    Thanks for all your info!

  • Hi Charlene,

    this problem is different. The DB content requires MOSS and you are restoring on a WSS server.

    That does not work. If the DB content requires MOSS you have to use it on a MOSS server. WSS is not sufficient.

    Cheers,

    Stefan

  • Stefan,

    But i did this in a sandbox environment... only problem there was the server names all needed updating so I went into the database and fixed the server names.

    Only thing different is my client and I both upgraded to SP1. Could this be the reason why

    Another blogger said i need to "redeploy the package" and it would update the GAC and all would be well... but i have no idea how to do this!!

  • Hi Charlene,

    doing such a direct manipulation of the DB content means that you cannot expect to get any support from Microsoft for your site.

    Never ever do this to a database you would like to keep!

    Cheers,

    Stefan

  • Great fix! Thank a lot. We were struggling with this for a while, but we also have another issue. We were getting the error on your post when going to the "Page Settings and Schedule" page. After running your fix it worked on some pages but now we are getting a "User cannot be found" error messages on pages that were created on the source server. I tried creating a script to modify the "Created By" and "Contact" fields, I was able to change the Contact but not the Created By property. Have you encountered this before or do you know how to change this property?

    Thanks!

  • Hi Tonny,

    sounds like a well known problem in MOSS.

    A hotfix for this is currently in the works and should be released soon. Please open a support case to ensure that you get the fix as soon as it becomes available.

    Cheers,

    Stefan

  • Thanks Stefan. Yes we had already open a support case for this but there was no resolution, we were just told they will consider fixing it on the next version of SharePoint... I'll keep an eye on it.

    Thanks again.

  • Got the answer by posting it on a forum! So I added the code on the post to your script to fix the "orphan users."

    You encounter this issue when backup/restoring a site to a different server and then delete the users on the restored site from the older server (in our case it was a stand alone server). When you go to page settings and schedule from a page created on the source server you get an error "User cannot be found"

    http://forums.msdn.microsoft.com/en-US/sharepointdevelopment/thread/219a83b7-019a-4379-9f47-2201faa0a7f6

    Tonny

  • Hi Tonny,

    as indicated: there is a hotfix in the works which should address this.

    Cheers,

    Stefan

  • If you thought that moving content from one environment to the other using SharePoint backup and restore

  • Something I've been meaning to discuss for a long time is the decision to develop SharePoint artifacts

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
Raw Html Fix