Restore-VEORIRDatabase

In this article

    Short Description

    Performs instant restore of a backed-up Oracle database.

    Applies to Veeam Backup & Replication

    Product Edition: Enterprise, Enterprise Plus, Veeam Universal License

    Syntax

    Restore-VEORIRDatabase [-Database] <VEORDatabase> -SwitchOverOptions <VEORIRSwitchOverOption> [-Server <string>] [-OracleHome <string>] [-GlobalDatabaseName <string>] [-OracleSid <string>] [-WindowsCredentials <pscredential>] [-OracleHomePassword <securestring>] [-LinuxCredentials <VEORLinuxCredential>] [-SshPort <int>] [-ToPointInTimeUTC <datetime>] [-File <VEORDatabaseFile[]>] [-TargetPath <string[]>] [-Force]  [<CommonParameters>]

    Detailed Description

    This cmdlet performs instant restore of a backed-up Oracle database. You can restore the database to the original location or to another location. For details, see the Instant Recovery section of the Veeam Explorers Guide.

    Parameters

    Parameter

    Description

    Type

    Required

    Position

    Accept Pipeline Input

    Database

    Specifies an Oracle database. The cmdlet will restore this database.

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

    True

    0

    True (ByValue)

    SwitchOverOptions

    Specifies a switchover option: automated, manual or scheduled.

    Accepts the VEORIRSwitchOverOption type. To get this object, run the New-VEORIRSwitchOverOptions cmdlet.

    True

    Named

    True (ByValue)

    Server

    For restore to another location.

    Specifies a name of the target Oracle server. The cmdlet will restore the database to the specified server.

    String

    False

    Named

    False

    OracleHome

    For restore to another location.

    Specifies the target Oracle home path. The cmdlet will restore an Oracle database to the location specified in the Oracle home path.

    String

    False

    Named

    False

    GlobalDatabaseName

    For restore to another location.

    Specifies the global database name. The cmdlet will restore an Oracle database with the specified name.

    String

    False

    Named

    False

    OracleSid

    For restore to another location.

    Specifies a new SID for an Oracle database. The cmdlet will restore the database with the specified SID.

    String

    False

    Named

    False

    WindowsCredentials

    Specifies Windows credentials. The cmdlet will use these credentials to connect to the Windows VM.

    PSCredential

    False

    Named

    False

    OracleHomePassword

    For restoring Oracle Database 12c or later on Windows server.

    Specifies Oracle home credentials. The cmdlet will use these credentials for starting Oracle Services on the VM guest OS.

    Note: This parameter is required in case you use the following types of Oracle home User:

    • Existing Windows user
    • New Windows user

    SecureString

    False

    Named

    False

    LinuxCredentials

    Specifies Linux credentials. The cmdlet will use these credentials to connect to the Linux VM.

    PSCredential

    False

    Named

    False

    ToPointInTimeUtc

    Specifies a restore period. The cmdlet will restore the Oracle database to the specified period.

    DateTime

    False

    Named

    False

    File

    Specifies an array of Oracle database files.

    Accepts the VEORDatabaseFile[] object. To get this object, run the Get-VEORDatabaseFile cmdlet.

    False

    Named

    False

    TargetPath

    Specifies the target path array. The cmdlet will restore the Oracle database files to the locations, specified in the array.

    Note: For every Oracle database file you must assign the specific file path.

    String[]

    False

    Named

    False

    Force

    Defines that the cmdlet will overwrite the existing Oracle database with the database from the backup.

    Note: The cmdlet will show no prompt before executing the command.

    SwitchParameter

    False

    Named

    False

    SshPort

    Specifies the SSH port number. The cmdlet will use that port to connect to the Linux VM.

    Default: 22.

    Int32

    False

    Named

    False

    <CommonParameters>

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

    Examples

    Restore-VEORIRDatabaseExample 1. Performing Instant Restore of Oracle Database to Original Location and Configuring Scheduled Switchover

    This example shows how to perform instant recovery of the orcl1.tech.local database to the original location using the switchover option. The cmdlet will perform the switchover at 13:00:00 on 2020-11-24.

    $time = Get-Date -Date "2020-11-24 13:00:00"

    $TimeUtc = $time.ToUniversalTime()

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

    $session = Get-VEORRestoreSession

    $database = Get-VEORDatabase -Session $session[0] -Name "orcl1.tech.local"

    Restore-VEORIRDatabase -Database $database -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. Convert the scheduled time to the UTC format using the ToUniversalTime() mehod. Save the result to the $TimeUtc variable.
    3. Run the New-VEORIRSwitchOverOptions cmdlet. Provide the Scheduled parameter and specify the SwitchingTimeUtc parameter value. Save the result to the $ScheduledSwitch variable.
    4. Run the Get-VEORRestoreSession cmdlet. Save the result to the $session variable.

    The Get-VEORRestoreSession cmdlet will return an array of restore sessions. Mind the ordinal number of the necessary restore session (in our example, it is the first restore session in the array).

    1. Run the Get-VEORDatabase cmdlet. Specify the Session and Name parameter values. Save the result to the $database variable.
    2. Run the Restore-VEORIRDatabase cmdlet. Set the $database variable as the Database parameter value. Set the $ScheduledSwitch variable as the VEORSwitchOverOptions parameter value.

    Restore-VEORIRDatabaseExample 2. Performing Instant Recovery of Oracle Database to Specific Server and Switching Over Manually

    This example shows how to restore the orcl01.tech.local database files to the latest restore point with the following settings:

    • The cmdlet will restore the database to the orcl1.tech.local target server.
    • The cmdlet will restore an Oracle database with the orcl2 name.
    • The cmdlet will restore the database with the orcl2 SID.
    • The cmdlet will restore an Oracle database to the /home/oracle/app/oracle/product/11.2.0/db_home_2 Oracle home path.
    • To perform the switchover operation manually, you must run the Switch-VESQLIRDatabase cmdlet.

    $restore = Get-VBRApplicationRestorePoint -Id fa4de91d-a493-41a8-88f7-1e29b0ab838d

    Start-VEORRestoreSession -RestorePoint $restore

    $session = Get-VEORRestoreSession

    $db = Get-VEORDatabase -Session $session[1] -Name "orcl01.tech.local"

    $ManualSwitch = New-VEORIRSwitchOverOptions -Manual

    $plainpassword = "Password1234"

    $securepassword = $plainpassword | ConvertTo-SecureString -AsPlainText -Force

    $linuxCredentials = New-VEORLinuxCredential -Account 'oracle' -Password $password -ElevateAccountToRoot

    Restore-VEORIRDatabase -Database $db -SwitchOverOptions $ManualSwitch -Server 'orcl1.tech.local' -OracleSid 'orcl2' -GlobalDatabaseName 'orcl2' -LinuxCredentials $linuxCredentials -OracleHome '/home/oracle/app/oracle/product/11.2.0/db_home_2 -Force

    $IRDatabase = Get-VEORIRDatabase -DatabaseName "orcl1.tech.local"

    Switch-VEORIRDatabase -Database $db

    Perform the following steps:

    1. Run the Get-VBRApplicationRestorePoint cmdlet to get the list of restore points and copy the ID of the required restore point. Save the restore point to the $restore variable.
    2. Run the Start-VEORRestoreSession cmdlet to start the database restore session.
    3. Run the Get-VEORRestoreSession cmdlet. Save the result to the $session variable.

    The Get-VEORRestoreSession cmdlet will return an array of restore sessions. Mind the ordinal number of the necessary restore session (in our example, it is the second restore session in the array).

    1. Run the New-VEORIRSwitchOverOptions cmdlet. Provide the Manual parameter. Save the result in the $ManualSwitch variable. Save the result in the $ManualSwitch variable.
    2. Declare the $plainpassword variable. Assign to this variable the password that will be used to connect to the target server.
    3. Declare the $securepassword variable. Assign to this variable the $plainpassword variable. Pipe the $securepassword variable output to the ConvertTo-SecureString cmdlet. Provide the AsPlainText and Force parameters.
    4. Run the New-VEORLinuxCredential cmdlet. Specify the Account, Password and ElevateAccountToRoot parameter values. Save the result to the $linuxCredentials variable.
    5. Run the Get-VEORDatabase cmdlet. Set the $session variable as the Session parameter value. Specify the Name parameter. Save the result to the $IRDatabase variable.
    6. Run the Restore-VEORIRDatabase cmdlet. Specify the following settings:
    • Set the $db as the Database parameter value.
    • Set the $ManualSwitch as the SwitchOverOptions parameter value.
    • Specify the Server parameter value.
    • Specify the OracleSid parameter value.
    • Specify the GlobalDatabaseName parameter value.
    • Set the $linuxCredentials variable as the LinuxCredentials parameter value.
    • Specify the OracleHome parameter value.
    1. Run the Get-VEORIRDatabase cmdlet. Specify the DatabaseName parameter value. Save the result to the $IRDatabase variable.
    1. Run the Switch-VEORIRDatabase cmdlet. Set the $IRDatabase variable as the Database parameter value.

    Related Commands