Use stsadm Command to Repair Corrupt SharePoint Database

While working with SharePoint server database, various operations need to be performed on a regular basis. A SharePoint database admin goes through a routine task of maintaining and backing up the database. However, at times he can experience some issues like corruption of the database. Most of times, they can be restored to their last backup. But, in case the affected database was being used after corruption, it becomes very difficult to back up such databases.

There could be various reasons for such behavior. Moreover, the corruption of the database also depends upon the version of the SharePoint server being used. More often Microsoft Office SharePoint Server 2007 (MOSS 2007) gets affected. However, such an issue can be overcome by using various command line utilities provided by MOSS 2007.

MOSS 2007 is a web application platform by Microsoft. It caters the need for an Intranet, Content and document management, and more. It has introduced various tools for command-line to be used by an administrator. The Stsadm is a very powerful tool to perform a complete set of operations on MOSS 2007. The tool gets installed along with the installation of Microsoft Office SharePoint Server 2007. You can navigate to the following path to find this tool:

%COMMONPROGRAMFILES%\microsoft shared\web server extensions\12\bin

This SharePoint repair tool can be run directly from the command-line or by using batch files or scripts on the server itself. In order to use this tool, you need to follow the below mentioned syntax:

-operation OperationName -parameter value

So, in order to overcome the situation of corrupt database using this tool, you need to first back up the Site Collection by using the following command:

stsadm -o backup -url [URL] -filename [filename] –overwrite

After this, you need to remove the content database from the MOSS. This can be done by going to the Central Administration > Application Management > Content databases.

Then, you can restore it to a new clean database by using the following command:

stsadm -o restore -url [URL] -filename [filename] -overwrite

The restored site would include all the lost functionalities and data.

However, you can always try alternative solutions if the above steps do not work for you. The most reliable option would be to go for a professional and trusted software. Stellar Phoenix SharePoint Recovery is a very useful utility to repair SharePoint databases files. It also supports recovery for MS SharePoint Server 2010.