How to Remove Content Database in SharePoint using PowerShell?

SharePoint content databases are the most important artifacts in the SharePoint platform as they hold the majority of the data. However, we may have to delete the content database from SharePoint at times. Here is how you can utilize PowerShell to delete the database:

How to delete a content database in central administration?

Login as a Farm administrator and follow these steps to delete a content database in central administration.

  • Go to SharePoint Central Administration >> Application Management >> Manage Content Databases in the Databases section
  • Select the web application from the dropdown menu and click on the name of the content database. 
  • In the Manage Content Database Settings page, select the “Remove content database” check box.  Confirm the prompt and click on OK to delete a content database in SharePoint.
    delete content database central administration

This detaches and removes the association of the content database from SharePoint. However, the content database still exists in SQL Server. If you want to remove the content database permanently, you must manually remove it from SQL Server as well. Just Open SQL Server Management Studio, From the list of Content Databases, find the one that needs to be deleted, Right-click, and delete! That’s all!!

SharePoint 2013: Remove content database using PowerShell

To delete a content database from SharePoint, use: Remove-SPContentDatabase cmdlet, which removes the content database from the SharePoint web application and deletes it from the SQL Server also.

Syntax:
Get-SPContentDatabase -Identity "ContentDB-Name" | Remove-SPContentDatabase

E.g. 
Get-SPContentDatabase -Identity "SP10_Intranet_Content02" | Remove-SPContentDatabase
sharepoint powershell delete content database

This deletes the SharePoint Content database from SharePoint and SQL Server permanently! As stated, use: Dismount-SPContentDatabase cmdlet if you want to remove the database from SharePoint alone!

Related Posts:

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

3 thoughts on “How to Remove Content Database in SharePoint using PowerShell?

  • Thank you,
    but how can I delete the configuration, user profile & content database from sql server alone ?
    Can i simply right click on the configuration database & make a delete?

    Reply
  • appreciated, thank you

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *