Sunday, April 24, 2011

Create SharePoint 2007 Site Collection in New Content Database

Create SharePoint Site Collection in a Specific Content Database
Ever wanted to create New Site collection in a particular database or Restore the site collection backup to a specific database?

If Yes, Here is the simple Trick: Increase the Maximum Number of Sites. SharePoint places New Sites in the content database where the [Maximum Number of site - Current Number of Sites] delta is a large number!

In Central admin > Manage Content Database page set these options: For all other existing databases

Set the Maximum number of sites = current Number of sites

Warning Level = Maximum number of sites -1

and then Set the Maximum number of sites and Warning Level values to Larger number of your desired database!

Then you can create or Backup-Delete-Restore your site collections.

Generally SharePoint will place the new site in this particular DB based on the difference between "Current number of Sites" and the "Maximum Number of Sites".

Say for e.g. I had "10" in "Current number of Sites" in all content DB's and 15000 in "Maximum Number of Sites", so I adjusted Maximum Number of Sites & Warning level to - 20000, and the new site I created went and sat into this particular DB.

Alternatively, you can go to Central Administration >> Application Management >> Content Databases and set the existed content databases(Except the one in which sites needs to be created) to “Offline” mode.

Create SharePoint Site Collection in New Content Database

If there is a requirement to create site collection in new or specific content database in SharePoint 2007, here is the stsadm command:

Create site collection in New content database in SharePoint 2010 using PowerShell:

Microsoft recommendation on content database size is not more than 100Gb for MOSS 2007 and 200 GB for SharePoint 2010, because

It simplifies the backup and restore operations

It provides flexibility on Disaster Recovery strategies.

Don't want any new site collections to be created in a particular DB?
Some times, we may want to limit the number of site collection in a particular DB. To achieve this, Go to Database settings in Central Admin, Change the Maximum number of site collections settings to be equal to the current number of site collections.