Monday, July 13, 2015

Moving a Site collection from one content database to another content database

Under some circumstances, you might want to move one or more SharePoint site collections to a different content database. For example, a site collection can outgrow the content database on which it resides, and you would have to move the site collection to a larger content database.
You can move site collections between databases in a SharePoint Server farm by using Microsoft PowerShell.

$siteUrl = Read-Host “Enter Site Collection URL to be moved”
$newDBName = Read-Host “Enter destination Database Name”
$contentDBInfo = Get-SPContentDatabase -Site $siteUrl
$oldDBName = $contentDBInfo.Name
Move-SPSite -Identity $siteUrl -DestinationDatabase $newDBName
Write-Host ""
Write-Host "Site collection " $siteUrl "has been moved from " $oldDBName "to " $newDBName " successfully." -ForegroundColor Blue

Create new Database in SQL Managemnet Studio.
In Central Administration add Database to Web Application.
Central Administration, Content Databases, choose Web Aplication, Add a content database.




















Run PowerShell as Administrator and start the script.







Possible error:

“Cannot complete the copy or merge operation because the database schema versions are different.”


Sometimes you content databases do not get properly upgraded during the installation of a cumulative update or service pack. There is a quick an easy fix. Just use the Upgrade-SPContentDatabase cmdlet to update the content database.


Upgrade-SPContentDatabase -Identity <content database name>



 

2 comments:

  1. This is such a great resource that you are providing and you give it away for free. I love seeing blog that understand the value. Im glad to have found this post as its such an interesting one! I am always on the lookout for quality posts and articles so i suppose im lucky to have found this! I hope you will be adding more in the future... local sherman oaks moving company

    ReplyDelete
  2. I tried upgrading the database but it says that the database doesnt need an upgrade. any workarounds for it?

    ReplyDelete