locked
Move Site Collections to another Web application RRS feed

  • Question

  • I know I can move one site collection to another web application (on a different database) by using backup and restore.

    But what if I have like 100 site collections I want to move out to another web app?  Is there any way I can do it at one go?  If yes, how?

    Thanks.

    Sunday, June 17, 2012 6:53 AM

Answers

  • hi,

    use stsadm -o mergecontentdbs for step 2. It can move all your desired site collections at once to a new content database before detaching it.

    the commands for doing this would look like this:

    stsadm -o addcontentdb -url http://webapp.contoso.com -databasename WSS_Content_NewDB
    stsadm -o enumsites -url http://webapp.contoso.com > output.txt
    edit output.txt  and remove the site collections you do not want to move.
    stsadm -o mergecontentdbs -url http://webapp.contoso.com -operation 3 -sourcedatabasename WSS_Content_OldDB -destinationdatabasename WSS_Content_NewDB -filename output.txt
    iisreset


    Dirk Van den Berghe

    Monday, June 18, 2012 7:55 AM
  • If you want to move all these seite collections and not copy, then consider detaching the databases form the source web application and attaching them to the destination web application.

    Detaching database = Central Administration => Manage Content database

    - select the web application

    - select the content database

    - check "Remove content database" ( will only detach the datbase form SharePoint and not remove form SQL)

    Attach database = Central Administration => Manage Content database

    - select the web application

    - select Add content database

    - specify name of content database previously removed form original web application

    You can also consider doing this using the SharePoint 2010 Management Shell (powershell) using the commands Remove-SPContentDatabase and Mount-SPContentDatabase


    Dirk Van den Berghe

    Sunday, June 17, 2012 11:40 AM
  • check the XML file. Sounds like you may have edited it incorrectly.

    it should look like this:

    <Sites Count="4">
      <Site Url="http://portal/sites/SiteA" Owner="CONTOSO\John" ContentDatabase="WSS_Content_OldDB" StorageUsedMB="0.5" StorageWarningMB="0" StorageMaxMB="0" />
      <Site Url="http://portal/sites/SiteB" Owner="CONTOSO\John" ContentDatabase="WSS_Content_OldDB" StorageUsedMB="1.2" StorageWarningMB="0" StorageMaxMB="0" />
      <Site Url="http://portal/sites/SiteC" Owner="CONTOSO\John" ContentDatabase="WSS_Content_OldDB" StorageUsedMB="2.4" StorageWarningMB="0" StorageMaxMB="0" />
      <Site Url="http://portal/sites/SiteD" Owner="CONTOSO\John" ContentDatabase="WSS_Content_OldDB" StorageUsedMB="1.1" StorageWarningMB="0" StorageMaxMB="0" />
    </Sites>


    Dirk Van den Berghe

    Tuesday, June 19, 2012 7:12 AM
  • Got it now.  It was my bad.  I used get-spsite to generate the list.

    Thanks for all the replies guys! Especially Dirk! Thanks man!

    Tuesday, June 19, 2012 10:46 AM

All replies

  • If you want to move all these seite collections and not copy, then consider detaching the databases form the source web application and attaching them to the destination web application.

    Detaching database = Central Administration => Manage Content database

    - select the web application

    - select the content database

    - check "Remove content database" ( will only detach the datbase form SharePoint and not remove form SQL)

    Attach database = Central Administration => Manage Content database

    - select the web application

    - select Add content database

    - specify name of content database previously removed form original web application

    You can also consider doing this using the SharePoint 2010 Management Shell (powershell) using the commands Remove-SPContentDatabase and Mount-SPContentDatabase


    Dirk Van den Berghe

    Sunday, June 17, 2012 11:40 AM
  • I agree with Dirk Answer but if the DB is too big then you need to use the stsadm command to achieve this.

    Aniket

    Monday, June 18, 2012 5:20 AM
  • Thanks for the responses guys!

    I could do that if I am moving ALL site collections over to the new one.  But I want to leave some site collections right where they are and move some to a new web application.

    To illustrate:

    WebApp A contains site collections SC1, SC2, SC3, etc... SC-A, SC-B, SC-C, etc.. 

    Now I want to move SC-A, SC-B, SC-C, etc.. into WebApp B and leave SC1, SC2, SC3, etc.. in WebApp A.

    One thing I know how to do this is:

    1.  Create a new database for WebApp A.
    2.  Move SC-A, SC-B, SC-C, etc to the new database using move-spsite cmd
    3.  Detach the new database from WebApp A.
    4.  Attach new database from WebApp A to WebApp B

    I can do this if I only have like less than 10 site collections that I want to move out.  But the thing is, I have to move quite a number of site collections.

    Any ideas? any one? :)

    Monday, June 18, 2012 7:47 AM
  • hi,

    use stsadm -o mergecontentdbs for step 2. It can move all your desired site collections at once to a new content database before detaching it.

    the commands for doing this would look like this:

    stsadm -o addcontentdb -url http://webapp.contoso.com -databasename WSS_Content_NewDB
    stsadm -o enumsites -url http://webapp.contoso.com > output.txt
    edit output.txt  and remove the site collections you do not want to move.
    stsadm -o mergecontentdbs -url http://webapp.contoso.com -operation 3 -sourcedatabasename WSS_Content_OldDB -destinationdatabasename WSS_Content_NewDB -filename output.txt
    iisreset


    Dirk Van den Berghe

    Monday, June 18, 2012 7:55 AM
  • Hi Dirk! You are right!  I never thought of that command!  Thanks man!

    I will try that one and come back here to confirm it works.

    Though I know it definitely will!

    Thanks!

    Monday, June 18, 2012 3:24 PM
  • If its SharePoint 2010.

    Then you can use the below approach. You may need to tweak the scripts based on your requirements.

    https://www.nothingbutsharepoint.com/sites/itpro/Pages/SharePoint-Gradual-Site-Collection-Deletion.aspx

    Hope this may help.


    Aniket

    Monday, June 18, 2012 11:38 PM
  • Hi Dirk. I tried the method.

    It gave me an error, "data at the root level is invalid".  I'm stuck again.

    Tuesday, June 19, 2012 3:25 AM
  • check the XML file. Sounds like you may have edited it incorrectly.

    it should look like this:

    <Sites Count="4">
      <Site Url="http://portal/sites/SiteA" Owner="CONTOSO\John" ContentDatabase="WSS_Content_OldDB" StorageUsedMB="0.5" StorageWarningMB="0" StorageMaxMB="0" />
      <Site Url="http://portal/sites/SiteB" Owner="CONTOSO\John" ContentDatabase="WSS_Content_OldDB" StorageUsedMB="1.2" StorageWarningMB="0" StorageMaxMB="0" />
      <Site Url="http://portal/sites/SiteC" Owner="CONTOSO\John" ContentDatabase="WSS_Content_OldDB" StorageUsedMB="2.4" StorageWarningMB="0" StorageMaxMB="0" />
      <Site Url="http://portal/sites/SiteD" Owner="CONTOSO\John" ContentDatabase="WSS_Content_OldDB" StorageUsedMB="1.1" StorageWarningMB="0" StorageMaxMB="0" />
    </Sites>


    Dirk Van den Berghe

    Tuesday, June 19, 2012 7:12 AM
  • Got it now.  It was my bad.  I used get-spsite to generate the list.

    Thanks for all the replies guys! Especially Dirk! Thanks man!

    Tuesday, June 19, 2012 10:46 AM