Content Database FAQ – SharePoint 2010


Last update: 09-11-2012
Since there is a lot of misconception on how different SharePoint components relate to each other, I will try to answer some common questions. Please feel free to comment or ask additional questions in the comment section. I will add them to the FAQ list.

The below figure shows the infrastructure of Content databases related to Web Applications and site collections.

SharePoint_Infrastructure

FAQ

1. Can we create a site collection in a specific Content Database?

Yes, but you can only do this by using PowerShell using the New-SPSite cmdlet. You can use the "-ContentDatabase" parameter to specify in which Content Database the site collection will be created.

2. When using the "-ContentDatabase" parameter in the New-SPSite cmdlet, does the content database get automatically created if it does not exist?
No, if you enter a Content Database name that does not exist, you will get an error saying the content database could not be found.

3. My site collection is getting very big, can I add a second Content Database to spread the load?
Because of the way SharePoint is designed, you cannot have 1 site collection spread over multiple Content Databases. If you want to split up your site collection in to multiple site collections, you can do this by exporting and importing subsites, or by using 3rd party tools.

4. What site collections are currently in my Content Database?
For this specific question, I have written a PowerShell one-liner that will return every Content Database with their respective site collections. You can find this one liner here: http://sharepointrelated.com/2012/03/09/get-site-collections-per-content-database-one-liner/

5. How can I check the size of my Content Database?
The easiest way to accomplish this is by looking at the database file on your SQL Server. But there may be some scenario’s where this is not possible. Insufficient permissions being the most common one. In this case, you can use this article to find out the approximate Content Database size: http://sharepointrelated.com/2012/03/07/content-database-size-report-using-powershell/

6. What Content Databases are attached to my Web Applications?
For this question, I have also written a small blog post. It will return all Web Applications with their respective Content Databases: http://sharepointrelated.com/2012/05/28/get-content-databases-per-web-application-one-liner/

7. Why are my Content Databases named WSS_Content_<Guid>?
The moment you create a Web Application, you will be asked to fill in details regarding your content database. By default, SharePoint will fill in this field for you with the following syntax: WSS_Content. If a content database with this name already exists, it will add a GUID to it.

8. What if I want to move my site collection to another Content Database?
In this case, there are 2 scenario’s:
- Move the site collection to another Content Database that is attached to the same Web Application
You can use the Move-SPSite cmdlet to move the site collection.
- Move the site collection to another Content Database that is attached to another Web Application
You can use the Backup-SPSite and Restore-SPSite functionality to accomplish this task.

9. I have multiple site collections in my Content Database, can I use PowerShell to see their sizes?
Yes, you can. You can use the following line of code to check the approximate size of your site collection (From Todd’s blog: Using PowerShell to find site collection size in SharePoint 2010)

Get-SPSite "http://someurl.com&quot; | select url, @{label="Size in MB";Expression={$_.usage.storage/1MB}}

10. Is it possible to maintain the same Content Database for more than one Web Application?
No, this is not possible. A Content Database can only be attached to a single Web Application.

About these ads

7 Responses to Content Database FAQ – SharePoint 2010

  1. Rene K. says:

    “When using the New-SPSite cmdlet. You can use the “-ContentDatabase” parameter to specify in which Content Database the site collection will be created.” Is a content database automatically created or does it need to be an existing content database, perhaps an ampty one you create yourself?

  2. Nico Martens says:

    Hi Rene,

    Thanks for the comment :)

    When you use the -ContentDatabase parameter for the New-SPSite cmdlet, the Content Database has to exist. If this database does not exist, you will receive an error saying the content database could not be found.
    You can however create an empty content database from the GUI, or use the New-SPContentDatabase cmdlet to create an empty content database.
    You can then use this content database to create the new site collection in.

  3. kansascoder says:

    I think the script in #9 should read :

    Get-SPSite “http://someurl.com” | select url, @{label=”Size in MB”;Expression={$_.usage.storage/1MB}}

    In order to get size in MB … No?

  4. PCM says:

    Nice Article

  5. Pingback: Blog de Juan Carlos González en Geeks.MS

  6. Ashu says:

    Very helpful for a newbie such as myself. THANKS!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: