Archive for December, 2011

Moving SharePoint 2010 Site Collections To New Content Databases using PowerShell

December 16, 2011 4 comments

So recently i’ve been preparing for a data migration between SharePoint 2007 and SharePoint 2010 farms.  In preperation for the migration I had to create seperate Site Collections with their own Content DBs.  Thats simple enough!  However I forgot to create the content dbs prior to building the new Site Collections…opps…so the Site Collections are now sitting in the main SharePoint content db.  Ok time to move these.

To move Site Collections into new Content DBs follow these simple steps.

First create the new Content DBs in Central Administration

1.  Browse to Central Administration -> Application Management -> Manage Content Databases
2. Change to the Web Application that will be used with these Content Dbs.
3.  Click ‘Add a content database’
4.  Give the database a Database Name
5.  Change the ‘number of sites before warning‘, and ‘maximum number of sites‘ to a number suitable for your Site Collection, or just keep the defaults.
6.  Click Ok

This will create the new Content DB.  Do this for all Content DBs that need to be created prior to creating the Site Collections.

Back on the Manage Content Databases page you will now see all the Content DBs you just created with 0 in the Current Number of Site Collections column.

Now on to PowerShell to move the Site Collections over.

1.  Remote or log into your Central Administration (CA) server.
2.  Bring up SharePoint 2010 Management Shell (PowerShell) with Administrator Rights
3.  Next type:

Move-SPSite <http://ServerName/Sites/SiteName&gt; -DestinationDatabase <DestinationContentDb>


4.  Hit Enter.  This will move the Site Collection from its current Content DB to the new Content DB

Now go back to:  Central Administration -> Application Management -> Manage Content Databases and you will now see that there should be a number 1 listed under the Current Number of Site Collections for that Site Collection Content DBs.

Thats it!  Pretty simple!

To test try to hit your Site Collection site to make sure that the page comes up!