4

I have created 2 site collections on one web application. How do I now assign a different database for these 2 site collections?

2 Answers 2

8

For this process to work, the following must be true

  1. The destination content database must already exist.
  2. The source content database and destination content database must be located on the same instance of SQL Server.
  3. The source content database and destination content database must be attached to the same Web application.

Steps

  • Add a content database to a web application by using Windows PowerShell
  • Move your site collection to another content database

To add a content database to a web application by using windows PowerShell

  • Start SharePoint 2013 Management Shell -Type in the following command

     New-SPContentDatabase -Name <ContentDbName> -WebApplication WebApplicationName
    
  • Replace <ContentDbName> with the name of the content database to create

  • Replace <WebApplicationName> with the name of the Web application to which the new database is attached

To move your site collection to another database:

  • At the Windows PowerShell command prompt, type the following command:

    Move-SPSite <http://ServerName/Sites/SiteName> -DestinationDatabase DestinationContentDb
    
  • Replace <http://ServerName/Sites/SiteName> with the name of the site collection.

  • Replace <DestinationContentDb> with the name of the destination content database.

3

With PowerShell. Move-SPSite

Move-SPSite http://servername/sites/sitename -DestinationDatabase ContentDb2

Be aware that you have to do an IISreset on all the servers in your farm after you move a site collection to a different content database, which means downtime for the end users.

3
  • There is adding new content db to existing web application has any downtime to users?
    – adilahmed
    Commented Mar 30, 2016 at 9:40
  • Move-SpSite do down for moving site collections or whole web application?
    – adilahmed
    Commented Mar 30, 2016 at 9:57
  • No, adding a new content database does not add any downtime. And as stated in MS article, move-spsite move a single site collection between content databases. A web application does not exist in a content database. Commented Mar 30, 2016 at 11:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.