共用方式為


AvailabilityDatabase.SuspendDataMovement 方法

Suspends the data movement on this availability database.

命名空間:  Microsoft.SqlServer.Management.Smo
組件:  Microsoft.SqlServer.Smo (在 Microsoft.SqlServer.Smo.dll 中)

語法

'宣告
Public Sub SuspendDataMovement
'用途
Dim instance As AvailabilityDatabase

instance.SuspendDataMovement()
public void SuspendDataMovement()
public:
void SuspendDataMovement()
member SuspendDataMovement : unit -> unit
public function SuspendDataMovement()

備註

Data movement on this availability database may not yet have been suspended after a call to SuspendDataMovement() returns control to the program. The following code snippet suggests one way to pause program execution until data movement on this availability database is suspended:

Server server = new Server("PrimaryServerName");
AvailabilityGroup ag = server.AvailabilityGroups["AgName"];
AvailabilityDatabase dbToSuspend = ag.AvailabilityDatabases["DbName"];
dbToSuspend.SuspendDataMovement();
while (!dbToSuspend.IsSuspended) {
    Thread.Sleep(10000);
    dbToSuspend.Refresh();
}

請參閱

參考

AvailabilityDatabase 類別

Microsoft.SqlServer.Management.Smo 命名空間