A web application is not limited to using a single
content database. SharePoint allows you to associate many content
databases to a web application. One of the reasons to do this could be
based on the size of the content database. If the content database is
larger than 200 gigabytes, it makes more sense to distribute this
content across two content databases.
A different consideration
is factoring the type of data that is being housed in the content
database. If there is a marketing site that contains media files such as
photos and video, it may be desirable to create a content database just
for this site collection data. Another example is housing all legal
data into one content database/site collection for a litigation
department.
Finally, a major benefit of
doing this is disaster recovery. Knowing where your data is, and how it
is structured, will allow you to implement a disaster recovery strategy
that is efficient, effective, and flexible.
The data that is created is
not the same, that is, we have various kinds of data. Data has different
properties and may even have different backup and restore service level
agreements. However, multiple content databases may be connected to one
web application.
This recipe will show how to
create multiple content databases to one web application and apply the
appropriate site collection to the corresponding content database.
Getting ready
Ensure that you are
a member of the Farm Administrators SharePoint group on the computer
accessing the Central Administration site. You must have the correct
permissions to create a database (typically dbcreator and sysadmin).
How to do it...
1. Open the Central Administration screen. Under Application Management in the Databases section, click Manage Content Databases.
2. At the top of the resultant page is the Add a content database option. Click the option and the following screenshot will be displayed:
3.
The database name is given a GUID suffix by default. Change the
database name to be relevant but use a naming convention. In the case of
the preceding screen, I will change database name to WSS_Content_Marketing. Keep the rest of the defaults and click OK.
The content database will be created and listed under Manage Content Databases.
4. To ensure that the site collection gets added to the proper content database, ensure that you are still under Manage Content Databases.
5. Click on the content database(s) you don't want the site collection to get added to.
6. Under the Database Information settings, set the Database status to Offline. Click OK. Refer to the next screenshot:
7. Navigate to Application Management, then Site Collections. Under this section, click Create site collections.
8. Fill the information for Title, URL, select a template, and include a primary site collection administrator. Click OK.
9. The site collection should be created and added to the appropriate content database. To check this, navigate back to the Manage Content Databases WSS_content_7777 is Stopped (offline) and the new site has been added to. screen. See the example shown in the following screenshot. WSS_Content_Marketing
10. Reverse the action from step 6 and put the content database back in Ready state.
How it works...
The first half of the procedure
is self explanatory. We are creating a content database under the
appropriate web application. The second half of the procedure takes the
database offline. This action will ensure that the next site collection
cannot be added to that database.
The action of assigning a
site collection to a content database is very similar to network load
balancing. The site collections are assigned quite evenly across the
content databases while they are online.
There's more...
When doing a SharePoint 2010
upgrade of multiple content databases, ensure that the first content
database that you add contains the root site for the associated web
application. The rest of the content databases for the web application
can be added in any order afterwards.
More info
There will be times when you
do not want to add any more site collections to a content database. In
order to accomplish this, perform the following steps:
1. In Central Administration, under the Databases section, click on the Manage Content Databases option.
2. Click on the database that you wish to no longer add site collections to.
3. Change the Maximum number of site collections settings (under Database Capacity Settings) to be equal to the current number of site collections.
4. Change the Number of sites before a warning event is generated setting to be one less that the current number of site collections.
More info
You have seen how to do
this recipe through the user interface. There is a way to do the same
procedure through scripting. PowerShell is the new way of scripting, but
the stsadm command set is still available. Here are both methods:
stsadm o createsiteinnewdb url <url> -owneremail <email> -ownerlogin <domain/name> -sitetemplate <site template>
title <title> -databaserver <serverdb> -databasename <dbname>
New-SPContentDatabase
New-SPSite