Tips to Repair Corrupt SharePoint Database : SharePoint Database Repair Blogs

Tips to Repair Corrupt SharePoint Database : SharePoint Database Repair Blogs

Published by Jacob Martin on September 30, 2014

If your application started to report an IO error with your SharePoint database and then you may get the error message as shown below:

“Cannot complete this action. Please try again”

Solution: If you have encountered above error message with your SharePoint database then you need to try following methods for fixing it.

Then you need to try command line tool-Databaserepair: Stsadm operation

For detecting and deleting the orphaned items from corrupt SharePoint content database. The SharePoint content database can get corrupt or get damaged due to uncertain reasons such as power failure, hardware failure, virus attack etc. and corrupt sharepoint database that contain orphaned items. An example of orphaned items is a document that may not have parent document.

Here is the syntax for the Database repair using-Stsadm operation:

Run following syntax for detecting the orphaned site

Stsadm-o databaserepair –url -databasename

Example: stsadm –o databaserepair –url http://myfirstsite.com –databasename

Then you need to run the following syntax for detecting the orphaned site

Stsadm –o databasereapair –url -databasename [-deletecorruption]

 Example: stsadm –o databaserepair –url http://myfirstsite.com –databasename -deletecorruption

Then you need to force the Power-Shell to Repair Content Database

For doing this you need to load the SharePoint management shell and run the following equivalent powershell command:

$db=Get-SPDatabase “Content_DB_Name”;

$db.Repair ($false);

$db.Update();

If both the above methods fail to repair the corrupt SharePoint database then you need to check the consistency of your database by disconnecting it from the SharePoint. You can even detach the content database from SharePoint using the “Deletecontentdb:Stsadm” operation. It detaches the contents database when the database name, server and the web application are specified.

downloadnow-8205510 buynow-6594277 learn-more-button-orange-5243664

Here is the syntax for the Deletecontentdb – Stsadm operation:

Stasadm-o deletecontentdb –url -databasename [-dataseserver]

Now you need to follow the steps mentioned below to check the consistency of the database after detaching it.

  • Firstly login into the SQL server
  • Then you need to Go to the SQL server management studio
  • Then you need to run the following command:
    • USE WSS_CONTENT GO
    • ALTER DATABASE WSS_CONTENT SET SINGLE_USER GO
    • DBCC CHECKDB (“WSS_CONTENT”) WITH NO_INFOMSGS
    • You will get the error message and details and recommendation for fixing the error message.
    • Then Re-run DBCC CHECKDB that suggest repair clause (repair_fast, repair_rebuilt, and repair_allow_database_loss).

Note: Some of the amount of data will be lost after performing repair_allow_data_loss, and the data loss will be directly proportional to the level of corruption.

For detecting and repairing these corrupt SharePoint database you can also try 3rd party recovery software SharePoint Repair Tool. With the help of this software you can instantly repair restoration of SharePoint database. If you want to recover only few important items or the whole database you can use this software. Then SQL database stores the data from all the document libraries, lists and sites connection, on SharePoint Server. If the MDF files of the SQL database gets damaged then you can lose your entire SharePoint Server data. In such a situation SharePoint Repair fixes almost all the data corruption issues efficiently recovered and the integrity efficiently maintained of valuable data.

downloadnow-8205510 buynow-6594277 learn-more-button-orange-5243664

how to  Repair Corrupt SharePoint Database

  1. Firstly launch the SharePoint Recovery Tool you would find an interface. This interface screen displays two options to recover SharePoint data: ‘Complete Repair’ and ‘Document Recovery’ Select as per your requirement.userguide-1-1702737
  2. If you choose ‘Complete Repair’, the screen will show the options for selecting and searching SQL Server (.MDF) files. Click on ‘Select File’ to select a SharePoint database for repair. If you do not know the actual path of the database which you want to repair, click on the ‘Search File’ to locate the MDF file in a specific drive. After selecting the desired file initiate the scanning process
  3. After finishing the scan, the software would generate a tree of all SharePoint database tables and will display it in the left pane. You can select the table in the tree and can have the entire preview in the right pane. Then Click on ‘Repair’ to begin repairing for the selected database.user-guide-3-2885080
  4. After clicking on ‘Repair’, this dialog box will appear. Specify the SQL Server name or Instance name and the desired destination path. Click on the ‘Browse’ option to choose the destination path. And select ‘OK’ button.user-guide-4-3812088
  5. Once this process gets completed, you would find a dialog box that displays this message ‘Recovered file saved at the desired location. This shows that Recovery Process has successfully completed’. And select ‘OK’ button.user-guide-5-1433840
  6. You would find another dialog box that asks whether you want to attach the repaired database to the web application. If you click on ‘Yes’ button, the above dialog box will be displayed. In the web application URL type, the name of the corrupt database and SQL Server Instance name. Then Select ‘OK’ button and proceed. When the process gets finished, you would be able to access the repaired database by opening the web application.user-guide-6-9526721