Provision Site Collection In A Specific Content DB In SharePoint

Creating a site collection is something very basic in SharePoint. However in production scenarios the site collection size grows exponentially and issues will begin to creep up when there are two site collections with enormous sizes in a single Content DB . Though a Single Content DB support size up to 4 TB, if the multiple site collections within the DB grows above 200GB , Microsoft warns of possible back/restore failure.

Hence as part of Content DB capacity planning its recommended to keep in mind the data growth rate and partition site collections across Content DBs.

How can we create Site collection in a Specific Content DB using PowerShell

  • Create new Content DB.

    New-SPContentDatabase -Name WSS_Content_HR -WebApplication http://c2931069022:1500/

    Create new Content DB

    In the Central Admin we can see the new Content DB listed out.

    Central Admin

  • Create Site Collection in the previously created Content DB

    New-SPSite "http://c2931069022:1500/sites/HR" -OwnerAlias "AD2012\SPInstaller_Priyan" -ContentDatabase WSS_Content_HR -Name "HR Facility" -Description "HR Site Collection" -Template "STS#0"

    Site Collection

    ContentDatabase

How can we create Site Collection in a Specific Content DB using Central Admin

create Site Collection

From Central Administration we normally don’t have the flexibility to choose the Content Database while creating a site collection. The site collection will be created by cyclically selecting the available content databases. As seen in the above screenshot the new site collection will either be added to WSS_Content_IT or WSS_Content_Payroll .

However we have a woraround for this situation. Let’s see how it is made possible.

Say I want to create a Payroll Site Collection within the Payroll Content DB. In this case make all other Content DB except Payroll as Offline/Stopped.

Payroll

To do that, click on the Corresponding DB and choose Database Status as Offline.

Corresponding DB

So now only Payroll DB is in started state.

Management

Go to Application Management and create the payroll site collection.

application Management

The site collection will automatically be created within the only active Content DB which is the Payroll DB.

Content DB

Now we have to click on each of the stopped content DBs and revert back the status to ready so that the DBs will be up and running. This is a hack by which we can force creating site collections in a particular Content DB.