Jul21

Unique Content Database per SharePoint Site Collection  

Categories: Admin

It’s a question that comes up in every deployment of SharePoint: Should I have many site collections or one site collection with many sub sites?  My definitive answer: “It depends”.  

This post isn’t to address that however.  Let’s assume you decided on many site collections.  Which will bring you to another question you’ll ask yourself.  Should I have one content database for all of the site collections, or one content database for each site collection?  My definitive answer: “It depends”.

This post isn’t to address that either.  Let’s assume that you decided on one content database per site collection.  Or, let’s assume that you are going to create a new site collection and you want it to have its own content database.  Now that, we are going to address.

So how to in SharePoint?  Well, it’s not exactly intuitive, but none-the-less we can do it.

*****
Update: after comments here and on Twitter, just want to explicitly state (I was a little vague in the post) that there are other ways to do this than just this method – this is just how I do it. And be sure to set the databases back to ‘Ready’ when you are done creating your site collection(s).
*****

In Central Administration, you need to examine the current Content Database situation for your application.  Browse to content databases at: Central Administration > Application Management > SharePoint Web Application Management

In our example, we only have one Content Database (WSS_Content_Clients) with 1 site collection in it.

image

First, let’s create a new content database.  So, click on ‘Add a content database’ and go through the steps.  I recommend naming the content database the name of the site collection.  In our example, I called it WSS_Content_NEWSITECOLLECTION.

image

Now if we look at our content databases for our web application, you’ll see that we have two.  And WSS_Content_NEWSITECOLLECTION has zero site collections in it.

image

So what will happen if we create a new site collection in this Web Application?  When creating a new site collection in Central Admin there isn’t a means to select which content database to use.  Or is there?… Umm hmm.

Edit WSS_Content_Clients database (the database you don’t want to have the new site collection), and set it’s status to ‘Offline’.  Don’t worry, the database isn’t offline in typical sense.  It just means that new site collections can’t be created in it.  (This is just a bad name all together, but oh well).

image

Now if we look at our content databases, we’ll see that only our WSS_Content_NEWSITECOLLECTION is available for new site collections.

image

You’re all set now.  Go and create yourself a new site collection, and it will automatically create itself in our new content database, WSS_Content_NEWSITECOLLECTION.  Afterwards, you can stop it by setting it to offline as well to prevent other site collections being created in it.

image

There are other ways to achieve what we just did, but this one works for me.  Old habits are hard to break I guess.

Now, the next question that you’ll most likely end up asking is: How on earth am I going to figure out which site collection goes with what content database from a management standpoint?  Naming conventions don’t carry us but so far do they?

No worries there either, head over to your list of site collections for you application at:
Central Administration > Application Management > Site Collection List

Select the site collection, and it will tell you what Content Database it is using.

image

 
Share It:          
 
 

Links to this post

Comments

mcody  commented on  Tuesday, July 21, 2009  5:31 PM 

You actually don't want to take the database "Offline" at least for any extended amount of time, or maybe at all.

The Profile Synchronization jobs will not work with the DB offline. There are probably other jobs that do not function with it in the offline state.

Also, when Microsoft moves site collections between databases when using the Admin Toolkit, they don't take a database offline, but rather change the warning to the exact number of existing sites and the maximum number to 0. You can also do the opposite and make the warning and maximum numbers very high which will make any new SC go to that particular DB. In my opinion, this is the preferred way of targeting a particular content DB since it is the method MS employs with the Admin Toolkit.

Dan Lewis  commented on  Tuesday, July 21, 2009  5:46 PM 

I probably shouldn't have been so vague in my post - I updated to call that out.

Truely this is just a temporary thing - set to offline and create your new sitecollection(s), then set them all back to Online/Ready.

Many ways to skin the cat that we call SharePoint. :)

Pete  commented on  Thursday, August 13, 2009  1:17 PM 

Much more interested in the rationale behind whether we should have one content DB per site collection or not. Aside from anticipating that the DB size <100GB what are the other criteria around this decision?

Dan Lewis  commented on  Thursday, August 13, 2009  5:30 PM 

Hi Pete, there a number of things to take into account such as:

- Adminsitration (many dbs or few)
- Backup / Recovery (many dbs or few)
- Segregation of security across collections
- General Taxonomy of the organization

That's the short answer, but in truth there are a lot of things to consider. Here's a good post that may get the thoughts flowing for you: http://blogs.technet.com/wbaer/archive/2007/06/04/site-collection-sizing-considerations.aspx

bangaarm  commented on  Thursday, September 17, 2009  5:51 AM 

but how to attach old site collections to the new content database??

Dan  commented on  Tuesday, September 22, 2009  11:35 AM 

Bangaarm - are you asking how to move a site collection from one content database to another? If so, I would like at using export/import stsadm commands...

You could also take a look at the Microsoft SharePoint Administration toolkit: http://technet.microsoft.com/en-us/library/cc508854.aspx

Steve Lineberry  commented on  Monday, October 19, 2009  7:33 PM 

I happen to do the same thing but mine is automated through webservices. See my post here: http://www.thelineberrys.com/default-category/how-to-store-each-sharepoint-site-collection-in-its-own-database.html

Leave a comment





CAPTCHA Image Validation