共用方式為


SPDatabase.AddFailoverServiceInstance Method

Identifies to SharePoint Foundation a server and a database service instance that hosts the mirror of the database.

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

Syntax

'Declaration
Public Sub AddFailoverServiceInstance ( _
    failoverServerInstance As String _
)
'Usage
Dim instance As SPDatabase
Dim failoverServerInstance As String

instance.AddFailoverServiceInstance(failoverServerInstance)
public void AddFailoverServiceInstance(
    string failoverServerInstance
)

Parameters

  • failoverServerInstance
    Type: System.String

    A string that contains the identification of the SQL server instance for the database. The string must be in the format server_name/database_service_instance_name.

Remarks

If the server was not previously registered with the farm, the method will register it. The parameter passed to AddFailoverServiceInstance(String) must be of the form “server_name/database_service_instance_name”; for example, BackupServer/Microsoft##SSEEMirror.

Examples

The following example shows how to register a mirror database with your SharePoint Foundation configuration database. The cdb is the SPDatabase object.

cdb.AddFailoverServiceInstance(“Server2/Microsoft##SSEEMirror”);
cdb.Update();

See Also

Reference

SPDatabase Class

SPDatabase Members

Microsoft.SharePoint.Administration Namespace