Description of a new command-line operation that you can use to repair content databases in Windows SharePoint Services (918744)
The information in this article applies to:
- Microsoft Windows SharePoint Services
SUMMARYThis article discusses a hotfix that you can apply that enables you to repair content databases in Microsoft Windows SharePoint Services. The hotfix introduces a new command-line operation that you can use with the Stsadm.exe command-line tool. This article describes how to obtain the hotfix. It also describes how to use the Stsadm.exe command-line tool with the new databaserepair command-line operation to detect and to delete orphaned items in content databases in Windows SharePoint Services. INTRODUCTIONThis article describes a new command-line operation in Windows SharePoint Services that you can use to repair content databases. You can use the databaserepair command-line operation with the Stsadm.exe command-line tool to detect and to delete orphaned items in content databases.
In certain situations, a content database that is used by Windows SharePoint Services may become corrupted. The corrupted database may contain orphaned items. For example, a document may not have a parent document library. Or, a list may not have a parent Windows SharePoint Services Web site. Before the new command-line operation that is described in this article was introduced, Windows SharePoint Services did not have a tool that you could use to repair and to maintain the integrity of a content database. The procedure that is described in this article is a supported method that you can use to repair content databases. Modifying a content database directly is not supported. MORE INFORMATIONHow to obtain the hotfixThis issue is fixed in the Windows SharePoint Services post-Service Pack 2 Hotfix Package that is dated June 1, 2006. For more information, click the following article number to view the article in the Microsoft Knowledge Base: 918743 Description of the Windows SharePoint Services post-Service Pack 2 hotfix package: June 1, 2006 Information about the hotfixThe hotfix adds a new databaserepair command-line operation that you can use with the Stsadm.exe command-line tool to repair a content database. You can use the Stsadm.exe command-line tool with the databaserepair operation to detect and to delete the following orphaned items in Windows SharePoint Services content databases: - A Windows SharePoint Services Web site that does not have a parent Windows SharePoint Services Web site
- A subweb that does not have a parent Windows SharePoint Services Web site
- A list that does not have a parent Windows SharePoint Services Web site
- A document that does not have a parent document library
- A list item that does not have a parent list
- A Web page that does not have a parent Windows SharePoint Services Web site
The databaserepair operation uses the following parameters: - Required parameters: url, databasename
- Optional parameter: deletecorruption
When you use the Stsadm.exe command-line tool with the databaserepair operation, the syntax is as follows. - To detect orphaned items, use the following command line:
stsadm -o databaserepair -url http://URLofWindowsSharePointServicesSite -databasename DatabaseName - To delete orphaned items, use the following command line:
stsadm -o databaserepair -url http://URLofWindowsSharePointServicesSite -databasename DatabaseName -deletecorruption
Things to considerConsider the following information before you perform the procedure that is described in this article to repair content databases in Windows SharePoint Services: - The Stsadm.exe command-line tool and the databaserepair operation can only detect certain types of orphaned items in a content database. The types of orphaned items that can be detected are listed earlier in the "Information about the hotfix" section.
- When you use this procedure to delete orphaned items, additional orphaned items may be created. You may not be able to delete the additional orphaned items.
- If you are running Microsoft Office SharePoint Portal Server 2003 and Windows SharePoint Services, this procedure may create orphaned items in the configuration database in SharePoint Portal Server 2003. After you perform this procedure, make sure that you run the Spsadm tool in SharePoint Portal Server 2003 to repair orphaned items in the configuration database.
- The databaserepair operation removes orphaned items from content databases in Windows SharePoint Services. If orphaned items are present in the configuration database, you have to clean up the orphaned items in the configuration database. To do this, use the Window SharePoint Services Central Administration tool to remove the content databases from the virtual server. Then, reattach the content databases to the virtual server. When you remove a content database from a virtual server, the Windows SharePoint Services Web sites that are in the content database are removed from the Sites table in the configuration database. If the Sites table in the configuration database lists Windows SharePoint Services Web sites that are not present in the content database, the Windows SharePoint Services Web sites are removed when the content database is removed from the virtual server. The Windows SharePoint Services Web sites are not added back to the content database when you reattach the content database to the virtual server. When you remove and then reattach the content databases to virtual server, you remove orphaned items from the configuration database.
Step 1: Detect and delete orphaned items in Windows SharePoint Services content databasesTo use the Stsadm.exe command-line tool with the databaserepair operation to detect and to delete orphaned items, follow these steps: - Click Start, click Run, type cmd, and then click OK.
- Type the following line at the command prompt, and then press ENTER:
cd /d %commonprogramfiles%\Microsoft Shared\Web Server Extensions\60\Bin - Detect orphaned items in the database. To do this, type the following line at the command prompt, and then press ENTER:
stsadm -o databaserepair -url http://URLofWindowsSharePointServicesSite -databasename DatabaseName A list of containers that contain orphaned items that are detected by the Stsadm.exe command-line tool is displayed. The number that appears in the <OrphanedObjects Count="Number"> line represents the number of orphaned containers. The following example is an example of a list that shows that 10 orphaned containers were detected by the tool:<OrphanedObjects Count="Number">
<Orphan Type="SPList" Id="{ID}" SiteId="{ID}" />
<Orphan Type="SPList" Id="{ID}" SiteId="{ID}" />
<Orphan Type="SPList" Id="{ID}" SiteId="{ID}" />
<Orphan Type="SPList" Id="{ID}" SiteId="{ID}" />
<Orphan Type="SPList" Id="{ID}" SiteId="{ID}" />
<Orphan Type="SPList" Id="{ID}" SiteId="{ID}" />
<Orphan Type="SPList" Id="{ID}" SiteId="{ID}" />
<Orphan Type="SPList" Id="{ID}" SiteId="{ID}" />
<Orphan Type="SPList" Id="{ID}" SiteId="{ID}" />
<Orphan Type="SPList" Id="{ID}" SiteId="{ID}" />
</OrphanedObjects> - Delete orphaned items. To do this, type the following line at the command prompt, and then press ENTER:
stsadm -o databaserepair -url http://URLofWindowsSharePointServicesSite -databasename DatabaseName -deletecorruption - Repeat steps 4 and 5 until the Stsadm.exe tool no longer detects any orphaned items. When orphaned items are no longer detected, the following data is displayed after you use the Stsadm.exe command-line tool:
<OrphanedObjects Count="0" />
Step 2: Run the Spsadm.exe tool if you are running SharePoint Portal Server 2003If you are running SharePoint Portal Server 2003, run the Spsadm.exe command-line tool with the repairorphans command-line operation to repair orphaned items that may be present in the configuration database. The repairorphans operation removes and then reattaches the PortalSiteName_SITE content database. When you run the Spsadm.exe tool with the repairorphans operation, orphaned items that may exist for the PortalSiteName_SITE content database are removed from the configuration database.
For more information about how to use the Spsadm.exe tool to clean up orphaned items in the configuration database, click the following article number to view the article in the Microsoft Knowledge Base:
918742
Description of a new command-line operation that is available for the Spsadm.exe command line tool that you can use to clean up orphaned items in the configuration database in SharePoint Portal Server 2003
Step 3: Remove and then reattach the content databases on the virtual serverWhen you remove a content database from a virtual server, the Windows SharePoint Services Web sites that are stored in that content database are not available until you reattach the content database to the virtual server. To avoid down time for users, perform this step during off-peak hours on a day and at a time when the server is not heavily used. To remove and then reattach the content database or content databases on the virtual server, follow these steps: - Click Start, click Administrative Tools, and then click SharePoint Central Administration.
- Under Virtual Server Configuration on the Windows SharePoint Services Central Administration page, click Configure virtual server settings.
- Click the virtual server that you want to configure, and then click Manage content databases under Virtual Server Management on the Virtual Server Settings page.
- On the Manage Content Databases page, click the content database that you want to remove.
- On the Manage Content Database Settings page, note the following settings:
- The database server
- The database name
- The database capacity settings
- Click to select the Remove content database check box, and then click OK. When you are prompted to confirm that you want to remove the content database, click OK.
- Click OK.
- On the Manage Content Databases page, click Add a content database.
- On the Add a Content Database page, specify the database server, the database name, and the database capacity settings. Then, click OK.
REFERENCESFor more information about the Stsadm.exe command-line tool, see the "Command-Line Operations" topic, the "Command-Line Parameters" topic, and the Command-Line-Properties" topic in the "Reference" chapter of the Microsoft Windows SharePoint Services Administrator's Guide. To obtain the Microsoft Windows SharePoint Services Administrator's Guide, visit the following Microsoft Web site:
Modification Type: | Minor | Last Reviewed: | 7/26/2006 |
---|
Keywords: | kbQFE kbbug kbfix kbWSSpreSP3fix kbhotfixserver kbpubtypekc KB918744 kbAudITPRO |
---|
|