Monday, November 5, 2012

7 Sharepoint ContentDatabase FAQ's


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. 
Make sure that the content database is already created. Else you will get an error saying the content database could not be found.
An alternative would be through Central Administration. But, that is a workaround.

2. If a site collection is outgrowing its content database size; can I add a second Content Database to it?

A SharePoint site collection cannot have more than one content database. 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.

3. How can I get a list of site collections in a Content Database?

Use this powershell command:Get-SPContentDatabase  Name of your Content DB
Get-SPContentDatabase | %{Write-Output "- $($_.Name)”; foreach($site in $_.sites){write-Output $site.url}}

4. Checking the size of my Content Database?

The easiest way to accomplish this is by looking at the database file on your SQL Server.

5. Which all Content Databases are attached to my Web Applications?

Below powershell command will return all Web Applications with their respective Content Databases:               Get-SPWebApplication | %{Write-Output "`n- $($_.url)"; foreach($cd in $_.contentdatabases){Write-Output $cd.name}}

6. How do I move my site collection to another Content Database?

In this case, there are 2 scenarios:
- Move the site collection to another Content Database that is attached to the same Web Application
Move-SPSite cmdlet to move the site collection.
(eg. Move-SPSite sitecollectionURL –DestinationDatabase WSS_Content_DBName)

- Move the site collection to another Content Database that is attached to another Web Application
Backup-SPSite and Restore-SPSite powershell commands

7. Can we use 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.



No comments:

Post a Comment