Move Site Collection to Another Content Database using PowerShell

Requirement: Found a SharePoint Site collection growing in size over a period of time and wanted to move the SharePoint 2013 site collection to another content database.

Solution:

Use the PowerShell Cmdlet Move-SPSite to move site collection from one content database to another. Here is how: First, identify the target content database to move your site collection. You can create a new content database with New-SPContentDatabase cmdlet. Next, Run Move-SPSite cmdlet with site collection URL and database name parameters.

Syntax:

Move-SPSite <Site-Collection-URL> -DestinationDatabase "<Database-Name>"

Example:

Move-SPSite "http://intranet.crescent.com/sites/ops" -DestinationDatabase "SP13_Intranet_Content08"

Here is our script in action:

move site collection to another content database sharepoint using powershell
Tips: To find the current database of the site collection, use: Get-SPSite “Site-collection-url” | Select ContentDatabase

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

3 thoughts on “Move Site Collection to Another Content Database using PowerShell

  • November 8, 2019 at 9:29 AM

    Hi,

    Move-SPsite command throws Execution Timeout error after 3 hours in production. Source site size is 65 GB and when tested in test server move-spsite works perfectly fine. Not sure what’s causing this issue of timeout. Please advise.

    Reply
    • November 9, 2019 at 6:08 AM

      Even I experienced this for large sites, So I ended up site backup-restore to new database!

      Reply
  • September 26, 2019 at 2:52 PM

    Hi,
    While moving we are getting timeout error site with size 130 GB and above, what can be done over here?
    How to avoid timeout error, We tried web.config solution but didn’t work fr us.

    Please suggest.

    Reply

Leave a Reply