다음을 통해 공유


SPContentDatabase.Repair Method

Repairs the content database.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
Public Function Repair ( _
    DeleteCorruption As Boolean _
) As String
'Usage
Dim instance As SPContentDatabase
Dim DeleteCorruption As Boolean
Dim returnValue As String

returnValue = instance.Repair(DeleteCorruption)
public string Repair(
    bool DeleteCorruption
)

Parameters

  • DeleteCorruption
    Type: System.Boolean

    true to delete corrupted site collections, Web sites, lists, and documents; otherwise, false.

Return Value

Type: System.String
An XML string that specifies the type, name, and ID of site collections, Web sites, and lists that are orphaned or are missing required child objects. The elements of the string are illustrated by the following example:

<OrphanedObjects Count="4" >
  <Orphan Type="SPSite" 
          Id="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" 
          Deleted="No" />
  <Orphan Type="SPWeb" 
          Name="name" 
          Id="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" 
          Deleted="No" />
  <Orphan Type="SPWeb" 
          Name="name" 
          Id="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" 
          SiteId="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" 
          Deleted="No" />
  <Orphan Type="SPList" 
          Name="name" 
          Id="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" 
          SiteId="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" 
          WebId="{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" 
          Deleted="No" />
</OrphanedObjects>

Remarks

Over time, the content database can accumulate objects that are corrupted. An object that should have a parent object might be orphaned; an object that should have a child object might not have one. These things can happen due to a variety of misfortunes: power failures, lost connectivity, application timeouts, software faults, or just plain bad luck.

To find out if a database contains such corruption, call the Repair method and then examine the string that the method returns. To delete the corrupted objects from the database, call the Repair method with true as the argument.

See Also

Reference

SPContentDatabase Class

SPContentDatabase Members

Microsoft.SharePoint.Administration Namespace