Read time 4 minutes

Summary: SharePoint database files, stored in SQL database format, hold data for SharePoint sites. Various SharePoint Server versions are compatible with specific SQL Server versions. Three types of databases save different content: Configuration, Central Administration content, and Content databases. Methods for restoring SharePoint content databases include using Central Administration, PowerShell commands, or SQL Server tools. These methods rely on backup files, and if recent data lacks backups, Kernel for SharePoint Server Recovery software can repair corrupt MDF database files effectively.

The SharePoint database files contain data for various SharePoint sites or collections of sites and operate akin to SQL database files. When you start working, the SharePoint Product Configuration wizard automatically creates the required database.

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: This comprises information pertaining to various aspects within Internet Information Services (IIS), including websites, web applications, trusted solutions, web part packages, site templates, and distributed cache configuration objects.
  • Central Administration content database: The Central Administration content database contains configuration data for the Central Administration site collection.
  • Content Database: The content databases store comprehensive site collection data, encompassing documents within document libraries, web part properties, audit logs, list information, sandboxed solutions, and more.

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 carry out this task, the account must hold membership in the SharePoint Farm Administrators Group. Once this condition is confirmed, proceed with the following 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 recovery techniques outlined earlier for restoring the SharePoint Server content database rely on having backup files. If you encounter database corruption affecting recent data without a corresponding backup, these methods may prove ineffective. In such a scenario, utilizing the Kernel for SharePoint Server Recovery software is advisable. This proficient recovery tool specializes in repairing corrupt MDF database files, offering two recovery modes and a preview feature. Following recovery, the retrieved data can be saved directly to a live SQL Server or as a batch file. The software is compatible with various SharePoint Server versions including 2019, 2016, 2010, and 2007. During the recovery process, the software ensures a clear preview and generates a comprehensive report upon successful recovery.

Kernel for SharePoint Server Recovery