none
Site collection restore on new URL failed

    Question

  • I try to move site collection to new URL using PowerShell commands Backup-SPSite and Restore-SPSite, but restore failed with "Restore-SPSite : Cannot rename old site / on restore". As a alternative to backup/restore I try to use Copy-SPSite to new URL, but I got simillar error "Copy-SPSite : Cannot rename old site / on copy". I made some investigations and from SQL Server trace I can see ,that stored procedure proc_RenameSite returned value 206 and according to this exception was thrown in SharePoint object model.

    Friday, December 06, 2013 6:26 PM

Answers

  • We found the reason of fail. The problem was caused, that site colletion contains items with URL length of 260 characters, what is platform limit. We get the list of problematic items using this select

    SELECT
       CONCAT([DirName], N'/', [LeafName]) AS [FullRelativePath],
       LEN(CONCAT([DirName], N'/', [LeafName])) AS [Length]
    FROM 
       [dbo].[AllDocs]
    ORDER BY 
       [Length] DESC

    Then we made backup and restore to new URL without any problems.

    • Marked as answer by Marian Kostal Tuesday, January 14, 2014 4:03 PM
    Tuesday, January 14, 2014 4:03 PM

All replies

  • Copy-SPSite is not meant to do what you're trying to do with it. It is only purposed for creating an upgrade evaluation site.

    Did you try moving the site to a new content database (as you won't be able to restore to the same content database)? What is the URL of the source and destination?


    Trevor Seward, MCC

    Follow or contact me at...
      

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Friday, December 06, 2013 6:31 PM
    Moderator
  • We try also another content database with the same result. Source URL is "/" and destination URL is "/sites/002".
    Friday, December 06, 2013 6:37 PM
  • I just tried this (original site is in SharePoint_CDB1) with no issues:

    Backup-SPSite http://spwebapp1 -Path C:\back.bak
    Restore-SPSite http://spwebapp1/sites/test2 -Path C:\back.bak -ContentDatabase "SharePoint_CDB2"
    

    Is this what you're doing? Is "sites" a wildcard Managed Path (it is by default, but just checking)?


    Trevor Seward, MCC

    Follow or contact me at...
      

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Friday, December 06, 2013 6:40 PM
    Moderator
  • Yes, I used similar commands. As for managed path "sites" it is default. The site collection I try to restore on new URL was migrated SP2007 - SP2010 - SP2013.

    Friday, December 06, 2013 6:46 PM
  • Can you provide the full PowerShell command and error (perhaps a screenshot), blanking out any sensitive information?

    Trevor Seward, MCC

    Follow or contact me at...
      

    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

    Friday, December 06, 2013 6:48 PM
    Moderator
  • We found the reason of fail. The problem was caused, that site colletion contains items with URL length of 260 characters, what is platform limit. We get the list of problematic items using this select

    SELECT
       CONCAT([DirName], N'/', [LeafName]) AS [FullRelativePath],
       LEN(CONCAT([DirName], N'/', [LeafName])) AS [Length]
    FROM 
       [dbo].[AllDocs]
    ORDER BY 
       [Length] DESC

    Then we made backup and restore to new URL without any problems.

    • Marked as answer by Marian Kostal Tuesday, January 14, 2014 4:03 PM
    Tuesday, January 14, 2014 4:03 PM