3 Methods to Restore SharePoint Content Database

Aftab Alam
Aftab Alam linkedin | Updated On - November 22, 2022 |

Read time 4 minutes

SharePoint database files store the data of various SharePoint sites or site collections. SharePoint database files are actually SQL database files. The SharePoint Product Configuration wizard creates the database automatically as soon as you start working on it.

Here is the following table, which shows where the SharePoint Server can host the database.

SharePoint Database Hosted Platform
SharePoint Server 2019 SQL Server 2016 and SQL Server 2017.
SharePoint Server 2016 Microsoft SQL Server 2016 and SQL Server 2014 Service Pack 1 (SP1).
SharePoint Server 2013 SQL Server 2008 R2 Service Pack 1 (SP1) and SQL Server 2012.

There are three types of database in the SharePoint Server which save different kind of content based on their functionalities.

  • Configuration Database: It contains data about Internet Information Services (IIS) websites, web applications, trusted solutions, web part packages, site templates, distributed cache configuration objects, etc.
  • Central Administration content database: The Central Administration content database contains configuration data for the Central Administration site collection.
  • Content Database: The content databases save all the content for a site collection, including the documents for files saved in the document libraries, web part properties, audit logs, list data, sandboxed solutions, etc.

The content-database saves the majority of your SharePoint data. If you lose the database due to any corruption or unintentional deletion, then you can recover the data using different methods:

Restore SharePoint Content Database Using Central Administration

To perform this action, the account should be a member of the SharePoint Farm Administrators Group. After ensuring this, follow the steps:

  1. Open Central Administration and go to the Backup and Restore section. Here, click Restore from a Backup.
  2. Choose Backup to Restore page. Select the backup from the list of backups that has the content database. Click Next.
  3. Choose the Component to Restore page and click the box for the content database. Click Next.
  4. Select Restore Options from ‘Type of Restore’ and click Same Configuration. A confirm page asks you to validate your selection. Click OK.
  5. Click Restore.

Restore the SharePoint Content Database Using PowerShell

To perform this action, you should be a member of the securityadmin fixed server role group and db_owner fixed database role group, and Administrators Group. After ensuring this, use the below step:

Open the SharePoint Management Shell and run the command:

Restore-SPFarm -Directory BackupFolderPath -RestoreMethod Overwrite -Item ContentDatabaseName [-BackupId <GUID>] [-Verbose]

It accesses the backup file and restores the database from it.

Restore SharePoint Content Database Using SQL Server Tools

Make sure that your SharePoint account is a member of sysadmin fixed server role. Then, you can perform the database restore using the following steps:

  1. Stop the SharePoint Timer Service.
  2. Connect to the database server with SQL Server Management Studio.
  3. Expand Databases, right-click the database for the restoration, and follow Tasks >> Restore >> Database.
  4. A Restore Database dialog box appears. Mention the destination and source accounts and select backup set or sets.
  5. Click ‘Options’ in the ‘Select a page’ pane.
  6. Choose ‘Overwrite the existing database’ at the Restore options.
  7. At the ‘Recovery state’ section:
    • Select ‘RECOVER WITH RECOVERY,’ to include all the transaction logs.
    • Select ‘RECOVER WITH NORECOVERY,’ to restore additional transaction logs.
  8. Click OK to complete the restore operation. Now, you can restart the SharePoint Timer service.
Final Words

The methods mentioned above to recover the content database for SharePoint Server are dependent on the backup files. So, if you face database corruption to some recent data for which backup was not taken, then any of these methods may not work for you. Then, you should use Kernel for SharePoint Server Recovery software. It is an efficient recovery tool to repair corrupt MDF database files. It provides two recovery modes and a preview facility. After recovery, you can save the data directly to a live SQL Server or batch file. It supports all the versions like SharePoint Server 2019, 2016, 2010, and 2007. While recovering, the software provides a clean preview and generates a report after a successful recovery.

Kernel for SharePoint Server Recovery