共用方式為


SPContentDatabase.CreateUnattachedContentDatabase Method (SqlConnectionStringBuilder)

Creates a content database object, from the database with the specified connection string, without registering it in the configuration database of the farm.

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

Syntax

'Declaration
Public Shared Function CreateUnattachedContentDatabase ( _
    connection As SqlConnectionStringBuilder _
) As SPContentDatabase
'Usage
Dim connection As SqlConnectionStringBuilder
Dim returnValue As SPContentDatabase

returnValue = SPContentDatabase.CreateUnattachedContentDatabase(connection)
public static SPContentDatabase CreateUnattachedContentDatabase(
    SqlConnectionStringBuilder connection
)

Parameters

Return Value

Type: Microsoft.SharePoint.Administration.SPContentDatabase
The content database.

Exceptions

Exception Condition
ArgumentNullException

The connection parameter is a null reference (Nothing in Visual Basic).

Remarks

Typically, unattached content databases are used for data recovery scenarios and to get orphaned site collections and sites.

See Also

Reference

SPContentDatabase Class

SPContentDatabase Members

CreateUnattachedContentDatabase Overload

Microsoft.SharePoint.Administration Namespace

Other Resources

Fine-grained Data Restoration from Unattached Database