Get All Content Databases Per Farm

How many Content Databases List Per Farm

In this post, we’ll get all content databases per farm, all content databases size per web application in SharePoint Farm.

Get Content Database Per Web Application in SharePoint

Addiotnaly, we’ll explore the following:

You may also like to check the full “SharePoint Farm Scan Report” PowerShell Script.

SharePoint Content Databases List Per Farm

What’s the SharePoint Content Database?

It’s a database that stores content for one or multiple site collections for a web application.

Create a content database in SharePoint 2019

SharePoint Content Database Limits and Recommendations

  • The supported limit for SharePoint Content Databases per farm is 500 content databases.
  • SharePoint 2019 supports 100TB of data for all content databases per farm.
  • It’s strongly recommended to use Windows Authentication when you create a new content database.
  • Keep content databases below 200 GB for general usage.
  • If the content database holds more than one site collection, the site collection should not exceed 100 GB.
  • To avoid large content database size, you should deploy multiple content databases per web application.
  • It’s very difficult and time-consuming to operate (backup – restore -upgrade) a large content database size.

You may also like to read SharePoint 2019: SQL Server Recommendations


Get All Content Databases Per Farm

In Central Administration, you can get the full list of Content Databases per web application.

Content database per web application in sharepoint

Actually, it’s almost difficult to get the full list of content databases per farm!

Get Content Databases Per Farm Using PowerShell

In this case, you should use PowerShell to list the content databases per farm as the following:

  • Open SharePoint Management Shell as Administrator.
Open SharePoint 2016 PowerShell - Upgrade and Migrate to Project Server 2016
  • Run the below cmdlet.
Get-SPContentDatabase

Below is the result of running “Get-SPContentDatabase” to get content databases list per farm.

Get Content databases per farm using PowerShell

The “Get-SPContentDatabase” cmdlet will also help you to get

  • Its associated web applications,
  • The number of site collections per content database.

How many Content Databases per farm?

As we earlier mentioned, the supported limit for SharePoint Content Databases per farm is 500 content databases.

In this section, we’ll learn how to get the count of Content Databases per farm using PowerShell as the following:

  • Open SharePoint Management Shell as Administrator.
Open SharePoint 2016 PowerShell - Upgrade and Migrate to Project Server 2016
  • Run the below cmdlet.
$CDBCount = (Get-SPContentDatabase).count
Write-Host "the number of content databases per farm" $CDBCount -ForegroundColor green
Get Content databases count per farm using PowerShell

You may also like to read Gell All Site Collections and SubSites Per Farm.


SharePoint Content Databases List Per Web Application

In this section, we’ll learn how to get the list of content databases per web application using PowerShell and Central Administration.

Content Databases List Per Web Application Using Central Administration

To get the list of content databases using central administration, you should do the following:

  • Open Central Administration, below Application Management, click on “Manage content databases”.
Get All Content Databases Per Farm
  • You can get the list of content databases per a specific web application by clicking on “Change Web Application” and select the web application that you need to list its content databases.
Content database per web application in sharepoint

Content Databases List Per Web Application Using PowerShell

Besides the Central Administration, you can use the PowerShell to get the list of content databases per a specific web application.

  • Open SharePoint Management Shell as Administrator.
Open SharePoint 2016 PowerShell - Upgrade and Migrate to Project Server 2016
  • Run the below cmdlet.
Get-SPContentDatabase -WebApplication "Web App URL"

Below is the result of running “Get-SPContentDatabase” to get content databases list per web application.

Get Content databases per web application using PowerShell

How many Content Databases per Web Application?

In this section, we’ll learn how to get the count of Content Database per Web Application using PowerShell as the following:

  • Open SharePoint Management Shell as Administrator.
Open SharePoint 2016 PowerShell - Upgrade and Migrate to Project Server 2016
  • Run the below cmdlet.
$CDBCount = (Get-SPContentDatabase -WebApplicati
on http://epm:7000).count
Write-Host "the number of content databases" $CDBCount -ForegroundColor green
Get Content databases count per web application using PowerShell

What’s the Current Content Database size Per Web Application?

Unfortunately, you can’t know the current size of the SharePoint Content Database through the Central Administration.

However, you can get the SharePoint content database size using PowerShell as well as SQL Server.

Get SharePoint Content Database Size Using PowerShell

Below are the steps to know What’s the size of the SharePoint content database per web application using PowerShell:

  • Open SharePoint Management Shell as Administrator.
Open SharePoint 2016 PowerShell - Upgrade and Migrate to Project Server 2016
  • Run the below cmdlet
Get-SPContentDatabase -WebApplication "WebAppURL" | select name, @{Name="Contenet Database Size (MB)"; Expressio
n={$_.disksizerequired/1MB}}
Get SharePoint Content Database size per web application using powershell

To get the content database size in GB, you should divide the value on 1024MB as this $_.disksizerequired/1024MB.

Calculate SharePoint Content Database size per web application using powershell

Keep content databases below 200 GB for general usage.

Get SharePoint Content Database Size In SQL Server

You can also get the database size in SQL Server by running the below query.

EXEC sp_helpdb @dbname= 'Database Name'
Calculate SharePoint Content Database size in SQL Server

Another query to get the database size in SQL Server by selecting first the database, then run the below query.

exec sp_spaceused
Get SharePoint Content Database size in SQL Server

Web Application Vs Content Database Vs Site Collection Vs SubSites

  • Each web application can hold multiple Content Databases.
  • Each web application can hold multiple Site Collections.
  • Each Content Database can hold multiple Site Collections.
  • Site Collection can be only stored in one Content Database.
  • You can’t create a site collection without having a web application with a content database.
  • Each Site Collection can hold multiple SubSites.
  • Each SubSite can also hold additional SubSites.
  • You can’t create a subsite without having a top-level site collection.

You may also like to read


PowerShell Script to get all Content Database details per SharePoint farm

In this section, we’ll introduce a simple PowerShell script that helps you to get the following:

  • The list of all SharePoint Content Databases per farm.
  • The list of all SharePoint Content Databases per web application.
  • What’s the content database’s current size?
  • How many site collections per each content database?
  • What’s the associated web application for each content database?
  • A warning alert if the number of content databases per farm is exceeded the supported limit.
  • A warning alert if the size of a content database is exceeded the supported limit.
Get All Content Databases Per Farm

Download the “Content databases per SharePoint farm” script on GitHub.


SharePoint Farm Scan Report

SharePoint Farm Scan Report is a PowerShell Script that helps you to scan farm objects to monitor the SharePoint farm limits by getting real statistics that would help you to administrate your farm effectively and efficiently.

SharePoint Farm Scan Report Statistics includes:

  1. List of SharePoint web applications per farm.
  2. The number of SharePoint web applications per farm.
  3. List of SharePoint Application Pools.
  4. The number of SharePoint application pools.
  5. List of running SharePoint service applications per farm.
  6. The number of running SharePoint service applications per farm.
  7. List of SharePoint content databases per farm.
  8. The number of SharePoint content databases per farm.
  9. List of SharePoint content databases per web application.
  10. The number of SharePoint content databases per web application.
  11. What’s the current content database size?
  12. List of SharePoint site collections per farm
  13. The number of SharePoint site collections per farm.
  14. List of SharePoint site collections per web application
  15. The number of SharePoint site collections per web application.
  16. List of SharePoint site collections per content database.
  17. The number of site collections per content database.
  18. Which content database stores the site collection?
  19. What’s the Site collection size?
  20. List of SharePoint SubSites Per farm.
  21. The number of SharePoint SubSites per farm.
  22. List of SharePoint SubSites per site collection.
  23. Total number of SubSites per site collection.
  24. Farm Report Summary.
SharePoint Farm Scan Report

Download the “SharePoint Farm Scan Report” full script on GitHub.


Applies to
  • SharePoint 2019.
  • SharePoint 2016.
  • SharePoint 2013 / SharePoint 2010.
Download
Conclusion

In conclusion, we have learned the following:

You may also like to read
Have a Question?

If you have any related questions, please don’t hesitate to Ask it at deBUG.to Community.

2 thoughts on “Get All Content Databases Per Farm”

  1. Pingback: PowerShell Script: SharePoint Farm Scan Report | SPGeeks

  2. Pingback: Get All Web Applications Per Farm | SPGeeks

Leave a Reply