Moving a SharePoint 2010 Site Collection to another Content Database

Moving a Content Database to another Site Collection has never been easier than in PowerShell.  Just fire up your PowerShell, add the Snap-In for SharePoint and run Move-SPSite.

PS C:Usersmrhodes> get-help Move-SPSite -full

NAME
    Move-SPSite

SYNTAX
    Move-SPSite [-Identity] <SPSitePipeBind> -DestinationDatabase <SPContentDatabasePipeBind> [-AssignmentCollection <S
    PAssignmentCollection>] [-Verbose] [-Debug] [-ErrorAction <ActionPreference>] [-WarningAction <ActionPreference>] [
    -ErrorVariable <String>] [-WarningVariable <String>] [-OutVariable <String>] [-OutBuffer <Int32>] [-WhatIf] [-Confi
    rm]

PS C:Usersmrhodes> Move-SPSite -Identity http://mysharepointsite.com.au/sites/user -destinationdatabase WSS-Content-NewUserDB

Confirm
Are you sure you want to perform this action?
Performing operation "Move-SPSite" on Target "http://mysharepointsite.com.au/sites/user".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"): y
WARNING: IIS must be restarted before this change will take effect. To restart IIS, open a command prompt window and
type iisreset.
 

And just that easily, my Site Collection has now been moved to a new Content Database!

Advertisement

2 Responses to Moving a SharePoint 2010 Site Collection to another Content Database

  1. Pingback: 2010 in review « Mark Rhodes

  2. Tim Philomeno says:

    Mark,

    Works great but what if I want to then move it back?…It seems that there is some cleanup that needs to be done because I get the error “Move-SPSite : Cannot insert duplicate key row in object ‘dbo.AllSites’ with unique index ‘Sites_Id’. The duplicate key value is (f3872332-d16e-4205-bd07-150f3aabadfc)”…if I look in the “from” database, the tables allsites, allwebs, and alllists still have a reference to the GUID…I am assuming that is what is throwing the error.

    Tim P

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: