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 the New-SPContentDatabase cmdlet.

Next, Run the Move-SPSite cmdlet with site collection URL and database name parameters.

Syntax:

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

Example:

Move-SPSite "https://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 - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

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

  • 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
    • Even I experienced this for large sites, So I ended up site backup-restore to new database!

      Reply
  • 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

Your email address will not be published. Required fields are marked *