• Home
  • /
  • Blog
  • /
  • SharePoint 2013 Create Site Collection in Separate Content Database

Site collection creation is an area I’ve seem many inexperienced IT folks struggle with.  Well, not exactly the ability to create site collections, but the lack of knowledge to decipher when a new site collection should be created and why.  That topic in itself could take another blog posting, but I’ll save that for another day.

Today’s blog is going to focus on a practice I always use when creating an initial site collection: database separation.  I like each site collection to have their own content database.  Call me a control freak, but I like knowing where my data is stored, even though we are cautioned by Microsoft not to touch the databases.

So how do we create this 1 to 1 mapping?  

My favorite tool to use is PowerShell.  (Disclaimer: When I say PowerShell, it refers to opening “SharePoint 2013 Management Studio”, which is basically PowerShell with the SharePoint libraries loaded.) You can use the user interface through Central Administration, but there is (what I consider) substantially more work that needs to be put in.  I understand that not SharePoint Admin has access to servers, so I’ve included a link to blog that describes how to do it through Central Admin.


Note:  These steps are the same for SharePoint 2010 as well as 2013; the only difference is that you will be using SharePoint 2010 Management Shell.

1.)  First Open SharePoint 2013 Management Shell

2.)  Then I typically set up some variables since I’m typically creating more than one at a time.

$dbname = “databaseName”
$webAppName = “SharePoint – 80”
$ownerAlias = “domainsp_farm”

3.)  After that comes the line to create the content database…you will obviously change the database parameter to one of your choosing. For the rest of the example, I’m going to give you the commands I would use when creating a site collection for “IT” content.

New-SPContentDatabase “WSS_Content_IT” -DatabaseServer $dbname -WebApplication $webAppName

4.)  Optional – I also prefer to use managed paths where I can, the line below shows you how to create one in PowerShell.

New-SPManagedPath -RelativeURL “/IT” -WebApplication $webAppName -Explicit

5.)  The last step is to actually create the site collection. There may be quite a few parameters you wish to change here including: “URL, “Name”, “Template” and of course match the “ContentDatabase” to the name you used in step 3.

New-SPSite -Url http://RootSiteURL/it -owneralias $ownerAlias -ContentDatabase “WSS_Content_IT” -Name “Information Technology” -Template “STS#0”

More about the template “STS#0”; it is the Team Site Template.  You can substitute any site template in here.  To see a list of the available site templates for your environment, just type the following command in PowerShell.


That is it.  Like I said before, I typically create multiple site collections at a time, so my end result is often similar to the script below.

$dbname = “databaseAlias”
$webAppName = “SharePoint – 80”
$ownerAlias = “domainsp_farm”

/*Create content databases */
New-SPContentDatabase “WSS_Content_CTH” -DatabaseServer $dbname -WebApplication $webAppName
New-SPContentDatabase “WSS_Content_IT” -DatabaseServer $dbname -WebApplication $webAppName
New-SPContentDatabase “WSS_Content_HR” -DatabaseServer $dbname -WebApplication $webAppName
New-SPContentDatabase “WSS_Content_Marketing” -DatabaseServer $dbname -WebApplication $webAppName
New-SPContentDatabase “WSS_Content_Finance” -DatabaseServer $dbname -WebApplication $webAppName
New-SPContentDatabase “WSS_Content_Risk” -DatabaseServer $dbname -WebApplication $webAppName

/*Create Managed Paths – Remove -Explicit if wildcard*/
New-SPManagedPath -RelativeURL “/CTH” -WebApplication $webAppName -Explicit
New-SPManagedPath -RelativeURL “/IT” -WebApplication $webAppName -Explicit
New-SPManagedPath -RelativeURL “/HR” -WebApplication $webAppName -Explicit
New-SPManagedPath -RelativeURL “/Marketing” -WebApplication $webAppName -Explicit
New-SPManagedPath -RelativeURL “/Finance” -WebApplication $webAppName -Explicit
New-SPManagedPath -RelativeURL “/Risk” -WebApplication $webAppName -Explicit

/*Create site collections */
New-SPSite -Url http://RootSiteURL -owneralias $ownerAlias -ContentDatabase “WSS_Content_Root” -Name “Content Type Hub” -Template “STS#0”
New-SPSite -Url http://RootSiteURL/cth -owneralias $ownerAlias -ContentDatabase “WSS_Content_CTH” -Name “Content Type Hub” -Template “STS#0”
New-SPSite -Url http://RootSiteURL/it -owneralias $ownerAlias -ContentDatabase “WSS_Content_IT” -Name “IT” -Template “STS#0”
New-SPSite -Url http://RootSiteURL/hr -owneralias $ownerAlias -ContentDatabase “WSS_Content_HR” -Name “HR” -Template “STS#0”
New-SPSite -Url http://RootSiteURL/marketing -owneralias $ownerAlias -ContentDatabase “WSS_Content_Marketing” -Name “Marketing” -Template “STS#0”
New-SPSite -Url http://RootSiteURL/finance -owneralias $ownerAlias -ContentDatabase “WSS_Content_Finance” -Name “Finance” -Template “STS#0”
New-SPSite -Url http://RootSiteURL/risk -owneralias $ownerAlias -ContentDatabase “WSS_Content_Risk” -Name “Risk” -Template “STS#0”

Happy SharePointing!

You might also like