Share via


Using what logic does SharePoint creates/restores site collections in a content database?

Imagine a scenario where you have 4 content databases attached with 1 web app.

 

Database Name

Database Status

Current Number of Sites

Site Level Warning

Maximum Number of Sites

ContentDB1

Started

5

9

15

ContentDB2

Stopped

2

9

15

ContentDB3

Started

4

9

15

ContentDB4

Started

4

8

15

You create a new site collection from central admin or using stsdam command. The new site collection gets created in 3rd content database i.e. ContentDB3. Why did this happen? Why didn't it use the 1st or the 2nd or the 4th content db?

The reason behind is simple and has been stated below:

SharePoint will always create/restore a site collection in a content db where difference between 'Site Level Warning' and 'Current Number of Sites' is maximum and the content db is not in offline(stopped) state. In this scenario the difference for each content db is:

ContentDB1: 9-5 = 4

ContentDB2: 9-2 = 7

ContentDB3: 9-4 = 5

ContentDB4: 8-4 = 4

As per the above calculation the maximum difference is in following order ContentDB2, ContentDB3, ContentDB4 and ContentDB1. However, ContentDB2 is in offline(stopped) state, so the site is created in ContentDB3 which has the difference as 5.

Note: In a scenario where there are 2 content dbs and both are started and having same difference 'Site Level Warning' and 'Current Number of Sites', then a new site collection will get created in the first content db that was created out of the two.

THIS POST APPLIES TO
  • Microsoft Office SharePoint Server 2007
  • Microsoft Windows SharePoint Services 3.0