Set-VESQLIRDatabase

In this article

    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 not modify the switchover option that starts the switchover immediately after database files are copied and synchronized.

    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 Common Parameters section of Microsoft Docs.

    Example

    Setting Scheduled Switchover for Microsoft SQL Server Database

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

    $time = Get-Date -Date "2020-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.
    3. Run the New-VESQLIRSwitchoverOptions cmdlet. Provide the Scheduled parameter and specify 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 as the Database parameter value.
    • Set the $ScheduledSwitch as the SwitchOverOptions parameter value.

    Related Commands