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

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 (48)

  1. Emmanuel Desigaud says:

    Hi Stefan,

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



  2. thomas says:

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

  3. Hi Thomas,

    You need to use export/import.



  4. Charlene says:


    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=, 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!

  5. 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.



  6. charlene63 says:


    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!!

  7. 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!



  8. Tonny says:

    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?


  9. 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.



  10. Tonny says:

    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.

  11. Tonny says:

    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"


  12. Hi Tonny,

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



  13. Anonymous says:

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

  14. Anonymous says:

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

  15. Anonymous says:

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

  16. Ralf Günther says:

    Hi Stefan,

    many thanks for this very interesting blog – a topic very common in SharePoint projects.

    1.  Is a backup/restore of SQL databases  supported for migrating just SharePoint collaboration site collection (meaning the ‘Publishing’ feature is not used and therefore disabled)?

    2. Does an stsadm ‘preparetomove’ before the backup/restore opearation help in any way?

    Many thanks in advance,

     Ralf Günther  

  17. Hi Ralf,

    1. there are currently no known issues for non-publishing sites.

    2. no. This operation does not change the links in the database.



  18. Adrian says:

    I wonder…

    I am having what seems to be a related problem, but with my /masterpage/ gallery…

    The site was restored from a backup from another farm. Obviously there are users in here that don’t belong (ie, users from the other farm).

    The problem is, that basically I cannot open any of the master pages. If i try opening them via the webdav interface, VS or notepad or any other text editor says "file not found". When I try to open one of them with SharePoint Designer, nothing happens! It just displays an hourglass for half a second after I double click the filename.

    On some further investigation, I’ve found this happens for not all, but most of the pages in the masterpage folder.

    SOME of the "Modified User"s that I click on tell me that the user doesn’t exist. But I can open some of these files with no problem?? Whether or not the user still exists doesn’t seem to be what’s causing this…

    I haven’t had any problems with any other library or list on this same restored site, only the _catalogs/masterpage!

    Thanks for reading


  19. Hi Adrian,

    I haven’t seen this flavor.

    Please open a support case with Microsoft to get this analyzed.



  20. Darren says:

    …except that export/import rarely, if ever, completes without crashing. Especially for larger site collections. For us, the only option is to backup and restore the SQL database.

    Once that is done, I would suggest running the stsadm extension available here:

    It solved the problem for us quickly and easily!

  21. ajay says:

    Hi Stefan,

    Using content deployment the Sharepoint desginer workflows don’t come through.

    Using stsadm -backup and stsadm – restore workflows come through.

    What do you suggest for Sharepoint designer workflows



  22. Hi Ajay,

    I haven’t been aware that content deployment and stsadm export/import behave different for SPD workflows. Are you sure about this?

    If yes, I would suggest to open a support case to get this analyzed.



  23. ajay says:

    Hi Stefan,

    Sorry for late follow up…regarding workflows

    I mentioned backup-restore… not export-import.



  24. Hi Ajay,

    you mentioned content deployment – which uses export – import.

    Anyway: please open a support case to get this analyzed in more detail.



  25. Hi Stefan,

    Our "Create Hierarchies" variation operation is failing due to page layouts with incorrect URL’s. I believe we restored the content with the backup/restore functions and that would be why our links are incorrect. Is this by design of the backup/restore function or a bug?


    Radi A.

  26. Hi Radi,

    as you can see in the article above this is by design.

    You should not use backup/restore to transfer a publishing site collection to farm with different server names.



  27. Hanif says:

    Hi Stefan,

    I was getting "File Not Found" error when i was trying to restore site collection backup from one server farm to another.I downloaded your console application and followed the steps mentioned above.When i ran the console app, i could see that the old server url’s were getting replaced by the current server url’s.However even after running this application, i’m still getting this "File Not Found" Error.Have i missed something here?

    Any help is higly appreciated.Thanks in advance.



  28. Hi Hanif,

    you should not use backup/restore at all.

    The workaround above should work but backup/restore is still not supported for your scenario.

    Please use stsadm -o export/import to transfer the database content to a new farm.



  29. Anonymous says:



  30. Anonymous says:

    It doesn’t give you much more details than the following message: "An error was encountered performing

  31. Subhasha H.L says:

    For "file not found" error check for search service. May be error with search services. have you restored to different server? The native backup nad restore is for restoring to the same machine.

  32. Anonymous says:

    SharePoint Diagnostics (SPDiag) Tool v1.0 for SharePoint Products and Technologies The real power of

  33. Anonymous says:

    SharePoint Diagnostics (SPDiag) Tool v1.0 for SharePoint Products and Technologies The real power of

  34. Anonymous says:

    SharePoint Diagnostics (SPDiag) Tool v1.0 for SharePoint Products and Technologies The real power of

  35. BT says:

    hi Stefan, I could not locate any information on product docs regarding your statement "… Official documentation of this support limitation is currently in the works…" Is backup/restore not fully supported between farms as of now? Thank you for your great article!

  36. Hi BT,

    as outlined in the blog article: currently not supported for site collection using the publishing feature.



  37. Anonymous says:

    SharePoint Diagnostics (SPDiag) Tool v1.0 for SharePoint Products and Technologies The real power of

  38. Esteban says:

    Hallo Stefan,

    can you please help me with a quick step by step copying the site collection from one fram to another?

    I have A new clean MOSS environment, with a site collection (collaboration site).

    And I have a very well used old Moss environment, both Moss enterprise edt.

    I want to copy all the data from the old site collection to the new one. The size of the old site is approx 50GB… Can I still use the stsadm tool to do a export / import?

    What is the fileextension for the file?



  39. Hi Esteban,

    on target you need to have an empty site collection – so no template assigned and not a site with collaboration template.

    Best is to create the target site collection using STSADM:

    STSADM -o createsite -url http://url-to-target-sitecollection -ownerlogin … -owneremail …

    Then export the site collection using STSADM:

    stsadm -o export -url http://url-to-source-sitecollection -filename myexportfile.cmp

    Then import the packate into the empty target site collection:

    stsadm -o import -url http://url-to-source-sitecollection -filename myexportfile.cmp

    Thats it.



  40. Anonymous says:

    As I discussed in an earlier article backup/restore between farms for publishing sites was unsupported

  41. Anthony Grace says:

    Hi Stefan,

    I’m a little confused. Here’s the way I would normally backup/restore to a different farm:

    * Create the empty site collection on the destination server

    * Using setsitelock, preparetomove and deletecontentdb commands, go on to detach and reattach the content database on the target server by moving the .mdf and.ldf files.

    * Use the addcontentdb command

    * Reset IIS and perform a full crawl

    Am I correct in presuming that this will not cause the error you mention in the blog?


    Anthony 🙂

  42. Hi Anthony,

    you would get the same problems. this method will not change the page layout URLs in the publishing pages.

    In addition preparetomove should not be used anymore.

    See here for details:



  43. Anthony Grace says:


    Thanks for getting back – that helps. What I am trying to do in my situation is to move the production site collection to a test VM to try applying the new SP2. What would you suggest as a set of recommended steps for someone attempting this? (I’m sure everyone will want to test the SP2 install first before installing it on production boxes).


    Anthony 🙂

  44. Just to test the SP2 installation you can use backup/restore.

    You just need to be aware that requests to the site might cause exception if you use different host name in the URL than on the source system.

    To fix these problems you can use the tool listed above.

  45. Arjita Chawla says:

    This is a great post!I had been struggling with this error..I had earlier found another solution one which required an Stsadm command..but since I am not the farm admin..i could not run it..This change using the SPD saved my life .Thanks 🙂

  46. Tariq Mardawi says:

    Thank you Stefan, I have manually fixed the incorrect links according to the steps mentioned above, it works fine.

  47. Prav33n1x says:

    Hi Stefan,

    How would one do this manually on SharePoint 2013 with SharePoint Designer 2013?



Skip to main content