Fixing “Database Restore Failed” in SharePoint – Step-by-Step Guide
Restoring a SharePoint database is crucial for recovering lost data, migrating to a new environment, or setting up a backup. However, the process can sometimes fail due to various reasons, including corrupt backups, permission issues, SQL Server errors, or SharePoint configuration mismatches.
This guide provides a detailed troubleshooting process to fix the “Database Restore Failed” error in SharePoint.
Common Error Messages:
- “Restore failed due to insufficient permissions.”
- “The backup file is corrupt or incomplete.”
- “Cannot overwrite an existing database.”
- “SQL Server error during restore operation.”
- “Database is in use and cannot be restored.”
Step 1: Verify Backup File Integrity
The first step is to ensure the backup file is not corrupt or incomplete.
How to Check Backup File Integrity:
- Locate the backup file (
.bak
or.mdf/.ldf
files). - Run the following SQL Server command to check for corruption:
RESTORE VERIFYONLY FROM DISK = 'C:\Backup\SharePointDB.bak'
- If the result is:
- ✅ “The backup set is valid” → Proceed to the next step.
- ❌ “The backup file is corrupt” → Try using a different backup file.
✔ If the backup is valid, move to Step 2.
❌ If the backup is corrupt, use a previous backup or a third-party tool to repair it.
Step 2: Ensure the Database is Not in Use
If the SharePoint database is currently being used, the restore process may fail.
Steps to Take the Database Offline in SQL Server:
- Open SQL Server Management Studio (SSMS).
- Click Databases → Find the SharePoint database.
- Run the following SQL command:
ALTER DATABASE SharePointDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
- Now, retry the restore process.
✔ If successful, proceed to Step 3.
❌ If the error persists, check for permissions or storage issues.
Step 3: Check Disk Space and Storage Availability
If the target server does not have enough space, the restore operation will fail.
How to Check Available Space:
- Open File Explorer → Right-click the drive where SQL Server stores databases.
- Click Properties → Check available space.
- Ensure at least 2x the backup size is available.
Free Up Space (If Needed):
- Delete unnecessary log files (
.ldf
). - Move old backups to another storage location.
- Increase disk capacity if required.
✔ If space is available, proceed to Step 4.
Step 4: Restore Database Using SQL Server Management Studio (SSMS)
- Open SSMS → Connect to the SQL Server instance.
- Right-click Databases → Select Restore Database.
- Choose Device → Click Browse → Select your backup file (
.bak
). - Under Options, check:
- ✅ “Overwrite the existing database” (if needed).
- ✅ “Close existing connections” to avoid conflicts.
- Click OK to start the restore process.
✔ If successful, move to Step 7: Reattach the Database to SharePoint.
❌ If the restore fails, proceed to Step 5 for manual restoration.
Step 5: Restore Database Using T-SQL (Manual Method)
If SSMS fails, try using T-SQL commands to restore the database manually.
Run This SQL Command in SSMS:
USE master;
RESTORE DATABASE SharePointDB
FROM DISK = 'C:\Backup\SharePointDB.bak'
WITH REPLACE,
MOVE 'SharePointDB_Data' TO 'C:\SQLData\SharePointDB.mdf',
MOVE 'SharePointDB_Log' TO 'C:\SQLLogs\SharePointDB.ldf';
✔ If successful, move to Step 7.
❌ If it fails, check for permission issues in Step 6.
Step 6: Fix SQL Server and SharePoint Permissions Issues
Check SQL Server Permissions
- Open SSMS → Connect to SQL Server.
- Run the following command to ensure your account has the necessary permissions:
EXEC sp_addsrvrolemember 'YourAdminAccount', 'sysadmin';
- Restart SQL Server and retry the restore.
Check SharePoint Farm Account Permissions
- Open SharePoint Central Administration.
- Go to Security → Configure Service Accounts.
- Ensure the Farm Account has Full Control in SQL Server.
✔ If permissions are correct, retry the restore.
Step 7: Reattach the Restored Database to SharePoint
Once the database is restored, it must be reattached to SharePoint.
Steps to Reattach the Database:
- Open SharePoint Management Shell as Administrator.
- Run the following PowerShell command:
Mount-SPContentDatabase -Name SharePointDB -DatabaseServer SQLSERVERNAME -WebApplication http://YourSharePointSite
- Check if the database is now available in SharePoint Central Administration.
✔ If successful, the site should now work correctly.
❌ If there are issues, perform Step 8.
Step 8: Verify and Repair the Restored Database
After restoring, verify that SharePoint services and database connections are intact.
Run SharePoint Health Check:
- Open SharePoint Management Shell.
- Run the following command to check for issues:
Test-SPContentDatabase -Name SharePointDB -WebApplication http://YourSharePointSite
- If errors are found, fix them using:
Repair-SPContentDatabase -Name SharePointDB
✔ If successful, the database is now restored and operational.
Preventing Future Database Restore Failures
✔ Perform Regular Backups – Always keep multiple backup copies.
✔ Test Backups Before Relying on Them – Run RESTORE VERIFYONLY
before restoring.
✔ Use a Staging Environment – Restore to a test server before production.
✔ Monitor Disk Space – Ensure at least 2x backup size is available.
✔ Grant Correct Permissions – Ensure SQL Server and SharePoint accounts have full access.