Pages

Friday, March 9, 2012

Simple concept: How to create site collection with different content database?

[Question]:
How to create a site collection that uses new content database?

[Answer]:
Here is a PowerShell script how to do it:


$webAppUrl = "{your web app url}"
$contentDBName="{new content db name}"
new-spcontentdatabase -name $contentDBName -webapplication  $webAppUrl -DatabaseServer "{your sql server for content Dbs}"

$db = get-spdatabase | where {$_.Name -eq $contentDBName}  
$db.AddFailoverServiceInstance("{your failover server}");
$db.Update()

new-spsite -name "{site collection anme}" -ContentDatabase $contentDBName -url "{site collection url}" -OwnerAlias "{domain\user to be a primary site collection administrator}"


For further reading:

1.  Here is my favorite Russian blogger who shares his wisdom on "Tips to create a Site Collection in new Content Database"

2. My post on Failover option in SharePoint 2010

3. New-spsite without parameter Template will create a root web for the site collection. The url of site collection will give you a blank page, and you are free to create any sites (spwebs) under the site collection.

 A small tip for newbie: you can get to the root web site collection properties through url : {your new site collection created without template}/_layouts/settings.aspx

No comments:

Post a Comment