Copy a Site Collection to a new database using PowerShell

It’s pretty common in the SharePoint world to move Site Collection(s) from one database to another.
But there may also be some scenarios where you need to copy a Site Collection (SC) from one content database (CDB) to another.

In this blog post, we will focus on that by using the Copy-SPSite cmdlet.
If you prefer to watch a video, don’t hesitate to browse my YouTube channel, or particularly how to Copy a Site Collection to a new content database using PowerShell.

When you wish to copy a Site Collection, the Site Collection being moved, AND the destination content database must be within the same Web Application.
Otherwise, you’ll need to use the Backup-SPSite & Restore-SPSite cmdlets.


Minimum requirements:

  • Securityadmin fixed server role on the SQL Server instance,
  • db_owner fixed database role on all databases that are to be updated,
  • Administrators group on the server on which you are running the PowerShell cmdlets,
  • New database must already exist (if you choose to copy to another database)


For testing purposes, I have created 1 site collection & 1 new content database within the same Web Application as follow:

  • Site Collection SOURCE (
  • SP2016_NewTestCDB (using the New-SPContentDatabase)


Check the Source Site Collection & destination content database are within the same Web Application

  • Open SharePoint Management Shell (or PowerShell and add the SharePoint snap-in)
  • Type the following cmdlet (where “portal” is your own root URL)


Get-SPSite | Where-Object {$_.Url -like "http://portal*"} | select Url, ContentDatabase, WebApplication

Site Collection SOURCE


Get-SPContentDatabase -WebApplication

New Content Database on same Web Application

We can clearly see that the Site Collection SOURCE and the new content database are on the same Web Application (


So let’s copy this SC into a new content database.


Current SOURCE Site Collection

To copy the SOURCE (with content) to the TARGET, run the following (replace with your own URL):

Copy-SPSite -Identity -DestinationDatabase SP2016_NewTestCDB -TargetUrl

Site Collection SOURCE successfully copied



Get-SPSite | Where-Object {$_.Url -like "http://portal*"} | select Url, ContentDatabase, WebApplication

Site Collection TARGET on new database



Number of Site Collections on each database


Navigate to the TARGET site collection and look at the results! (note: the title will need to be changed)


Site Collection copied in TARGET



Comments are closed.

%d bloggers like this: