共用方式為


Start-AzureSiteRecoveryPlannedFailoverJob

啟動 Site Recovery 計劃性故障轉移作業。

注意

本文件中參考的 Cmdlet 用於管理使用 Azure Service Manager(ASM) API 的舊版 Azure 資源。 建立新的資源時,不建議使用此舊版 PowerShell 模組,因為 ASM 已排定淘汰。 如需詳細資訊,請參閱 Azure Service Manager 淘汰

Az PowerShell 模組是使用 PowerShell 管理 Azure Resource Manager (ARM) 資源的建議 PowerShell 模組。

語法

Start-AzureSiteRecoveryPlannedFailoverJob
     -RPId <String>
     -Direction <String>
     [-WaitForCompletion]
     [-Optimize <String>]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryPlannedFailoverJob
     -ProtectionEntityId <String>
     -ProtectionContainerId <String>
     -Direction <String>
     [-WaitForCompletion]
     [-Optimize <String>]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryPlannedFailoverJob
     -RecoveryPlan <ASRRecoveryPlan>
     -Direction <String>
     [-WaitForCompletion]
     [-Optimize <String>]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]
Start-AzureSiteRecoveryPlannedFailoverJob
     -ProtectionEntity <ASRProtectionEntity>
     -Direction <String>
     [-WaitForCompletion]
     [-Optimize <String>]
     [-Profile <AzureSMProfile>]
     [<CommonParameters>]

Description

Start-AzureSiteRecoveryPlannedFailoverJob Cmdlet 會針對 Azure Site Recovery 保護實體或復原方案啟動計劃性故障轉移。 您可以使用 Get-AzureSiteRecoveryJob Cmdlet 來檢查作業是否成功

範例

範例 1:啟動計劃性故障轉移作業

PS C:\> $Container = Get-AzureSiteRecoveryProtectionContainer 
PS C:\> $Protected = Get-AzureSiteRecoveryProtectionEntity -ProtectionContainer $Container 
PS C:\> Start-AzureSiteRecoveryPlannedFailoverJob -Direction PrimaryToRecovery -ProtectionEntity $Protected -Optimize ForDowntime
ID               : c38eecdc-731c-405b-a61c-08db99aae2fe
ClientRequestId  : 32ace403-0916-4967-83a1-529176bd6e88-2014-49-06 15:49:24Z-P
State            : NotStarted
StateDescription : NotStarted
StartTime        : 
EndTime          : 
AllowedActions   : {}
Name             : 
Tasks            : {}
Errors           : {}

第一個命令會使用 Get-AzureSiteRecoveryProtectionContainer Cmdlet,取得目前 Azure Site Recovery 保存庫中所有受保護的容器,然後將結果儲存在$Container變數中。 在此範例中,有單一容器。

第二個命令會使用 Get-AzureSiteRecoveryProtectionEntity Cmdlet,取得屬於儲存在 $Container 容器的受保護虛擬機。 命令會將結果儲存在 $Protected 變數中。

最後一個命令會以儲存在 $Protected 中受保護虛擬機的 PrimaryToRecovery 方向啟動故障轉移作業。

參數

-Direction

指定故障轉移的方向。 此參數可接受的值為:

  • PrimaryToRecovery
  • RecoveryToPrimary
類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-Optimize

指定要優化的內容。 此參數適用於從 Azure 月臺故障轉移至需要大量數據同步處理的內部部署網站。 此參數可接受的值為:

  • ForDowntime
  • ForSynchronization

指定 ForDowntime,這表示數據會在故障轉移前同步處理,以將停機時間降到最低。 同步處理會在不關閉虛擬機的情況下執行。 同步處理完成之後,作業就會暫停。 繼續作業以執行額外的同步處理作業,以關閉虛擬機。

指定 ForSynchronization,這表示數據只會在故障轉移期間同步處理,因此數據同步處理會最小化。 因為已啟用此設定,因此虛擬機會立即關閉。 同步處理會在關機後啟動,以完成故障轉移作業。

類型:String
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-Profile

指定此 Cmdlet 從中讀取的 Azure 設定檔。 如果您未指定設定檔,此 Cmdlet 會從本機預設配置檔讀取。

類型:AzureSMProfile
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False

-ProtectionContainerId

指定要啟動作業之受保護容器的標識碼。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-ProtectionEntity

指定 Site Recovery 保護實體物件。

類型:ASRProtectionEntity
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-ProtectionEntityId

指定要 啟動作業的 ASRProtectionEntity 物件。 若要取得 ASRProtectionEntity 物件,請使用 Get-AzureSiteRecoveryProtectionEntity Cmdlet。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-RecoveryPlan

指定復原計劃物件。

類型:ASRRecoveryPlan
Position:Named
預設值:None
必要:True
接受管線輸入:True
接受萬用字元:False

-RPId

指定要啟動作業之復原計劃的標識碼。

類型:String
Position:Named
預設值:None
必要:True
接受管線輸入:False
接受萬用字元:False

-WaitForCompletion

表示 Cmdlet 會先等候作業完成,再將控制權傳回 Windows PowerShell 控制台。

類型:SwitchParameter
Position:Named
預設值:None
必要:False
接受管線輸入:False
接受萬用字元:False