Content databases are the single most significant artifacts in SharePoint. Content databases are the repository where all SharePoint content lives. Let me summarize some of the frequently asked questions on SharePoint content databases.
1: Can a Site Collection spitted into one or more Content Databases?
No! This is by design limitation. Any SharePoint content database can have one or more site collection, but the reverse is not possible. One Site collection cannot be spitted into more than one content database.
2: How to get all content Databases of a my SharePoint Farm?
To get all content databases which are in use:
Get-SPDatabase | Sort-Object Name | Format-Table Name
Get All SharePoint Databases – including which are not currently attached to SharePoint web apps:
Get-SPContentDatabase | Sort-Object Name | Format-Table Name
3. SharePoint content database recommended size?
Recommended size: 100 GB. 200GB Max for SharePoint 2016! In special scenarios, up to 4TB! Refer: Software boundaries and limits for SharePoint Servers 2016 and 2019. and you can have upto 500 content databases per SharePoint 2016 farm!
4. How to Get the Content Database Size?
Content database size can be retrieved using this PowerShell:
To get all Database sizes in E-mail, use this PowerShell script: SharePoint Content Databases Size Report
5. How to get all Content Databases of a SharePoint Web Application?
Go to: SharePoint 2016 Central Administration >> Application Management >> Manage Content databases >> Pick your web application to get list of content databases associated.
You can get all content databases of a web application using PowerShell:
(Get-SPWebApplication "http://intranet.crescent.com/").ContentDatabases | Select -ExpandProperty Name
6. How to Find in which content database a specific site collection is stored?
To get in which content database site collectionlives, Go to SharePoint 2013 Central Administration >> Application Management >> View all site collections >> Pick your site collection. Now, you’ll find the content database of the site collection as in below screen:
Use this PowerShell script to find the content database of the site collection:
To get the content database for each site collection, refer: Get Content Database for All Site collections
7. How to get all Site collections in a content database?
To find all SharePoint site collections which are stored inside a content database, use this PowerShell script:
(Get-SPContentDatabase "SP16_Content_Crescent_Intranet").Sites | Select URL
Refer this post to get all site collections of all content databases: Get All SharePoint Site Collections in All Content Databases
8. Can I create a Site Collection in a particular Content Database?
Yes! You can. By default, SharePoint uses the logic: Largest difference between the Maximum Number of Site Collections and the Current Number of Site Collections to create site collections. You can’t specify a particular content database through SharePoint Central Administration. However, Using PowerShell, You can create a site collection in a specific content database: Create Site Collection in New/Specific Content Database
9. How to move a Site collection from one Content Database to Another?
Use: Move-SPSite cmdlet to move a SharePoint site collection from one content database to another. Refer this post for more detailed instructions: Move site collection from One Content Database to Another
10. How to set SharePoint content database to read-only?
You can set SharePoint content database to read only either from SQL Server Management Studio or PowerShell. Refer: How to Set SharePoint 2013 Content Database to Read Only Mode