Set-VESQLIRDatabase

Short Description

Modifies switchover settings for a specified Microsoft SQL Server database.

Applies to

Veeam Backup & Replication

Product Edition: Enterprise, Enterprise Plus, Veeam Universal License

Syntax

Set-VESQLIRDatabase [-Database] <VESQLIRDatabase> [-SwitchOverOptions] <VESQLIRSwitchOverOptions> [<CommonParameters>]

Detailed Description

This cmdlet allows you to modify the switchover settings for a specified Microsoft SQL Server database.

Set-VESQLIRDatabase Important!

You can only modify the switchover settings until the moment switchover is automatically triggered (if the Auto or Scheduled switchover options are selected).

Parameters

Parameter

Description

Type

Required

Position

Accept Pipeline Input

Database

Specifies a published Microsoft SQL Server database within an instant recovery session.

Accepts the VESQLIRDatabase object. To get this object, run the Get-VESQLIRDatabase cmdlet.

True

0

True (ByValue)

SwitchOverOptions

Specified a new switchover option for the specified Microsoft SQL Server database.

Accepts the VESQLIRSwitchOverOptions object. To create this object, run the New-VESQLIRSwitchOverOptions cmdlet.

True

1

True (ByValue)

<CommonParameters>

This cmdlet supports Microsoft PowerShell common parameters. For more information on common parameters, see the About CommonParameters section of Microsoft Docs.

Example

Setting Scheduled Switchover for Microsoft SQL Server Database

This example shows how to set scheduled switchover for the fiscal database. The switchover will be performed on 2023-12-4 at 13:00:00.

$time = Get-Date -Date "2023-12-4 13:00:00"

$TimeUtc = $time.ToUniversalTime()

$ScheduledSwitch = New-VESQLIRSwitchOverOptions -Scheduled -SwitchingTimeUtc $TimeUtc

$IRDatabase = Get-VESQLIRDatabase -DatabaseName "fiscal"

Set-VESQLIRDatabase -Database $IRDatabase -SwitchOverOptions $ScheduledSwitch

Perform the following steps:

  1. Run the Get-Date cmdlet and specify the date and time when the switchover must be performed. Save the result to the $time variable.
  2. Use the ToUniversalTime() method to convert the date and time to the UTC format. Save the result to the $TimeUTC variable.
  3. Run the New-VESQLIRSwitchoverOptions cmdlet. Provide the Scheduled parameter. Set the $TimeUTC variable as the SwitchingTimeUtc parameter value. Save the result to the $ScheduledSwitch variable.
  4. Run the Get-VESQLIRDatabase cmdlet. Specify the DatabaseName parameter value. Save the result to the $IRDatabase variable.
  5. Run the Set-VESQLIRDatabase cmdlet. Specify the following options:
  • Set the $IRDatabase variable as the Database parameter value.
  • Set the $ScheduledSwitch variable as the SwitchOverOptions parameter value.

Related Commands

Page updated 4/19/2024

Page content applies to build 12.2.0.334