Restore-VEHANADatabase

Short Description

Restores a backed-up SAP HANA database.

Applies to

Veeam Backup & Replication

Product Edition: Enterprise Plus, Veeam Universal License

Syntax

This cmdlet provides parameter sets that allow you to:

  • Restore a tenant SAP HANA database to another server using a point in time state of the backup file.

Restore-VEHANADatabase -TargetServerName <String> -TargetSystemName <String> [-TargetDatabaseName <String>][-Database] <VEHANADatabase> -PointInTime <DateTime> -TimeZone <TimeZoneInfo> [-TargetSystemUserPassword <SecureString>] [-GuestCredential <PSCredential>] [-ApplicationCredential <PSCredential>] [-UseHttps <SwitchParameter>] [-UseSSL <SwitchParameter>] [-ClientCertificatePath <String>] [-ClientCertificatePassword <SecureString>] [-Force <SwitchParameter>] [<CommonParameters>]

  • Restore a tenant SAP HANA database to another server using a specific backup.

Restore-VEHANADatabase -TargetServerName <String> -TargetSystemName <String> [-TargetDatabaseName <String>] [-Backup] <VEHANABackupCatalogItem> [-TargetSystemUserPassword <SecureString>][-GuestCredential <PSCredential>] [-ApplicationCredential <PSCredential>] [-UseHttps <SwitchParameter>] [-UseSSL <SwitchParameter>] [-ClientCertificatePath <String>] [-ClientCertificatePassword <SecureString>] [-Force <SwitchParameter>] [<CommonParameters>]

  • Restore a tenant SAP HANA database to another server using a backup prefix.

Restore-VEHANADatabase -TargetServerName <String> -TargetSystemName <String> [-TargetDatabaseName <String>] [-Database] <VEHANADatabase> -Prefix <String> [-TargetSystemUserPassword <SecureString>] [-GuestCredential <PSCredential>] [-ApplicationCredential <PSCredential>] [-UseHttps <SwitchParameter>] [-UseSSL <SwitchParameter>] [-ClientCertificatePath <String>] [-ClientCertificatePassword <SecureString>] [-Force <SwitchParameter>] [<CommonParameters>]

  • Restore an SAP HANA database to the original server using the latest state of the backup file.

Restore-VEHANADatabase [-Database] <VEHANADatabase> [-TargetSystemUserPassword <SecureString>] [-GuestCredential <PSCredential>] [-ApplicationCredential <PSCredential>] [-UseHttps <SwitchParameter>] [-UseSSL <SwitchParameter>] [-ClientCertificatePath <String>] [-ClientCertificatePassword <SecureString>] [-Force <SwitchParameter>] [<CommonParameters>]

  • Restore an SAP HANA database to the original server using a point in time state of the backup file.

Restore-VEHANADatabase [-Database] <VEHANADatabase> -PointInTime <DateTime> -TimeZone <TimeZoneInfo> [-TargetSystemUserPassword <SecureString>] [-GuestCredential <PSCredential>] [-ApplicationCredential <PSCredential>] [-ClearLog <SwitchParameter>] [-UseHttps <SwitchParameter>] [-UseSSL <SwitchParameter>] [-ClientCertificatePath <String>] [-ClientCertificatePassword <SecureString>] [-Force <SwitchParameter>] [<CommonParameters>]

  • Restore an SAP HANA database to the original server using a backup prefix.

Restore-VEHANADatabase [-Database] <VEHANADatabase> -Prefix <String> [-TargetSystemUserPassword <SecureString>] [-GuestCredential <PSCredential>] [-ApplicationCredential <PSCredential>] [-UseHttps <SwitchParameter>] [-UseSSL <SwitchParameter>] [-ClientCertificatePath <String>] [-ClientCertificatePassword <SecureString>] [-Force <SwitchParameter>] [<CommonParameters>]

  • Restore an SAP HANA database to the original server using a specific backup.

Restore-VEHANADatabase [-Backup] <VEHANABackupCatalogItem> [-TargetSystemUserPassword <SecureString>] [-GuestCredential <PSCredential>] [-ApplicationCredential <PSCredential>] [-UseHttps <SwitchParameter>] [-UseSSL <SwitchParameter>] [-ClientCertificatePath <String>] [-ClientCertificatePassword <SecureString>] [-Force <SwitchParameter>] [<CommonParameters>]

Detailed Description

This cmdlet restores a backed-up SAP HANA database. After you start a restore job, you can use the Get-VEHANARestoreJobActionLogItems cmdlet to get an overview of the restore process. You can also stop the restore process with the Stop-VEHANARestoreJob cmdlet or restart a failed restore job using the Restart-VEHANADatabaseRestore cmdlet.

Parameters

Parameter

Description

Type

Required

Position

Accept Pipeline Input

Backup

Specifies an SAP HANA backup from the backup catalog.

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

True

0

True (ByValue)

Database

Specifies an SAP HANA database. The cmdlet will start a restore job for the specified database.

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

True

0

True (ByValue)

ApplicationCredential

Specifies the credentials for the target SAP HANA system.

Note: This parameter is obligatory when the plug-in on the target machine is managed by a standalone Veeam Plug-in for SAP HANA.

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

False

Named

False

ClearLog

Clears the log area and restores the database as of the last log backup before the selected point in time.

Note: To ensure stable operation of the database on the target system, this parameter is automatically used when restoring a tenant SAP HANA database to another server.

SwitchParameter

False

Named

False

ClientCertificatePassword

Specifies the password of the private key used for client validation.

A password is only required if the certificate was exported with password protection enabled.

SecureString

False

Named

False

ClientCertificatePath

Specifies the path of the private key used for client validation.

String

False

Named

False

Force

Defines that the cmdlet will overwrite an existing SAP HANA database with an SAP HANA database from the backup.

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

SwitchParameter

False

Named

False

GuestCredential

Specifies the credentials for the target SAP HANA server.

Note: This parameter is obligatory when the plug-in on the target machine is managed by a standalone Veeam Plug-in for SAP HANA.

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

False

Named

False

PointInTime

Specifies a point in time in the backup file. The cmdlet will restore the database to the state of the specified point in time.

Note: You must specify the time zone of the selected point in time using the TimeZone parameter.

DateTime

True

Named

False

Prefix

Specifies the backup prefix of the SAP HANA backup you want to use.

String

True

Named

False

TargetDatabaseName

Specifies the name of the restored database on the target server.

String

False

Named

False

TargetServerName

Specifies the name of the target server.

String

True

Named

False

TargetSystemName

Specifies the name of the target system.

String

True

Named

False

TargetSystemUserPassword

Specifies the SYSTEM database user password for the newly created database on the target server.

Note: This parameter is only required if the restore process creates a new database on the target server.

SecureString

False

Named

False

TimeZone

Specifies the time zone of the point in time state to which you want to restore your data.

TimeZoneInfo

True

Named

False

UseHTTPS

Defines that Veeam Explorer for SAP HANA will use the HTTPS protocol for establishing a connection to the target SAP HANA server.

SwitchParameter

False

Named

False

UseSSL

Defines that Veeam Explorer for SAP HANA will use the SSL protocol for establishing a connection to the target SAP HANA system.

SwitchParameter

False

Named

False

<CommonParameters>

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

Output Object

The cmdlet returns the VEHANARestore object, that contains information about the status of the SAP HANA restore job.

Examples

Restore-VEHANADatabaseExample 1. Restoring Latest State to Original Location

This example shows how to restore an SAP HANA database to the original location. Note that in this example, the plug-in on the SAP HANA machine is managed by a protection group in Veeam Backup & Replication, so the GuestCredential and ApplicationCredential parameters are not used. The cmdlet will use the credentials specified in the backup policy.

$session = Get-VEHANARestoreSession

$system = Get-VEHANASystem -Session $session[0]

$database = (Get-VEHANADatabase -System $system)[0]

$restore = Restore-VEHANADatabase -Database $database

Perform the following steps:

  1. Run the Get-VEHANARestoreSession cmdlet. Save the result to the $session variable.

The cmdlet will return an array of restore sessions. Note the ordinal number of the necessary restore session. In our example, it is the first restore session in the array.

  1. Run the Get-VEHANASystem cmdlet. Set the first restore session in the $session variable as the Session parameter value.
  2. Run the Get-VEHANADatabase cmdlet and set the $system variable as the System parameter value. Select the necessary database returned by this command and save it to the $database variable. In our example, it is the first database in the array.
  3. Run the Restore-VEHANADatabase cmdlet. Set the $database variable as the Database parameter value.

Save the result to the $restore variable to be able to use it with other cmdlets.

Restore-VEHANADatabaseExample 2. Restoring Point in Time State to Original Location

This example shows how to restore a point in time state of an SAP HANA database to the original server. Note that in this example, the plug-in on the SAP HANA machine is managed by a protection group in Veeam Backup & Replication, so the GuestCredential and ApplicationCredential parameters are not used. The cmdlet will use the credentials specified in the backup policy.

$session = Get-VEHANARestoreSession

$system = Get-VEHANASystem -Session $session[0]

$database = (Get-VEHANADatabase -System $system)[0]

$pit = Get-Date -Date "2023-05-25 15:00:00"

$timezone = Get-TimeZone "Central Europe Standard Time"

$restore = Restore-VEHANADatabase -Database $database -PointInTime $pit -TimeZone $timezone -ClearLog

Perform the following steps:

  1. Run the Get-VEHANARestoreSession cmdlet. Save the result to the $session variable.

The cmdlet will return an array of restore sessions. Note the ordinal number of the necessary restore session. In our example, it is the first restore session in the array.

  1. Run the Get-VEHANASystem cmdlet. Set the first restore session in the $session variable as the Session parameter value.
  2. Run the Get-VEHANADatabase cmdlet and set the $system variable as the System parameter value. Select the necessary database returned by this command and save it to the $database variable. In our example, it is the first database in the array.
  3. Run the Get-Date cmdlet and specify the date and time of the state you want to restore your database to. Save the result to the $pit variable.
  4. Run the Get-TimeZone cmdlet and specify the required time zone. Save the result to the $timezone variable.
  5. Run the Restore-VEHANADatabase cmdlet. Specify the following settings:
  • Set the $database variable as the Database value.
  • Set the $pit variable as the PointInTime value.
  • Set the $timezone variable as the TimeZone value.
  • Provide the ClearLog parameter to remove all log segments in the log area and restore the database as of the last log backup before the selected point in time. Note that this may cause loss of in-memory data, so perform this action only if the log area is unavailable.

Save the result to the $restore variable to be able to use it with other cmdlets.

Restore-VEHANADatabaseExample 3. Restoring a Tenant Database to Another Server Using Backup Prefix

This example shows how to restore a tenant SAP HANA database to another server using a backup prefix. This example uses secure restore.

Note that Veeam Plug-in for SAP HANA must be installed and properly configured on the target server, and the plug-in account must have the necessary permissions. For more information, see the Considerations and Limitations section of the Veeam Explorers User Guide.

$session = Get-VEHANARestoreSession

$system = Get-VEHANASystem -Session $session[0]

$database = (Get-VEHANADatabase -System $system)[0]

$guestCredential = Get-Credential

$appCredential = Get-Credential

$newUserPasswordText = "qQ121213"

$newUserPassword = ConvertTo-SecureString $newUserPasswordText -AsPlainText -Force

$certificatePasswordText = "15pqw1"

$certificatePassword = ConvertTo-SecureString $certificatePasswordText -AsPlainText -Force

$restore = Restore-VEHANADatabase -Database $database -TargetServerName "saphana02" -TargetSystemName "HXE" -Prefix "backup_1" -GuestCredential $guestCredential -ApplicationCredential $appCredential -TargetSystemUserPassword $newUserPassword -UseHttps -UseSSL -ClientCertificatePath "C:/Users/Admin/Desktop/certificate.pfx" ClientCertificatePassword $certificatePassword

Perform the following steps:

  1. Run the Get-VEHANARestoreSession cmdlet. Save the result to the $session variable.

The cmdlet will return an array of restore sessions. Note the ordinal number of the necessary restore session. In our example, it is the first restore session in the array.

  1. Run the Get-VEHANASystem cmdlet. Set the first restore session in the $session variable as the Session parameter value.
  2. Run the Get-VEHANADatabase cmdlet and set the $system variable as the System parameter value. Select the necessary database returned by this command and save it to the $database variable. In our example, it is the first database in the array.
  3. Run the Get-Credential cmdlet to create a credential object. Enter the OS (<sid>adm) user and password that will be used for authenticating to the target SAP HANA server. Save the result to the $guestCredential variable.
  4. Run the Get-Credential cmdlet to create a credential object. Enter the database user account and password that will be used for authenticating to the target SAP HANA system. Save the result to the $appCredential variable.
  5. Declare the $newUserPasswordText variable and assign to it the password for the new SYSTEM database user created for the restored database.
  6. Run the ConvertTo-SecureString cmdlet. Set the $newUserPasswordText variable as the String parameter value. Provide the AsPlainText and Force parameters. Save the result to the $newUserPassword variable.
  7. Declare the $certificatePasswordText variable and assign to it the password for the new SYSTEM database user created for the restored database.
  8. Run the ConvertTo-SecureString cmdlet. Set the $certificatePasswordText variable as the String parameter value. Provide the AsPlainText and Force parameters. Save the result to the $certificatePassword variable.
  9. Run the Restore-VEHANADatabase cmdlet. Specify the following options:
  • Set the $database variable as the Database parameter value.
  • Specify the TargetServerName parameter value.
  • Specify the TargetSystemName parameter value.
  • Specify the Prefix parameter value.
  • Set the $guestCredential variable as the GuestCredential parameter value.
  • Set the $appCredential variable as the ApplicationCredential parameter value.
  • Set the $newUserPassword variable as the TargetSystemUserPassword parameter value.
  • Provide the UseHttps parameter.
  • Provide the UseSSL parameter.
  • Specify the ClientCertificatePath parameter value.
  • Set the $certificatePassword variable as the ClientCertificatePassword parameter value.

Save the result to the $restore variable to be able to use it with other cmdlets.

Restore-VEHANADatabaseExample 4. Restoring Tenant Database to Another Server Using Specific Backup

This example shows how to restore a tenant SAP HANA database to another server using a backup prefix. This example uses secure restore.

Note that Veeam Plug-in for SAP HANA must be installed and properly configured on the target server, and the plug-in account must have the necessary permissions. For more information, see the Considerations and Limitations section of the Veeam Explorers User Guide.

$session = Get-VEHANARestoreSession

$system = Get-VEHANASystem -Session $session[0]

$database = (Get-VEHANADatabase -System $system)[0]

$backup = (Get-VEHANABackupCatalogItem -Database $database)[2]

$guestCredential = Get-Credential

$appCredential = Get-Credential

$newUserPasswordText = "qQ121213"

$newUserPassword = ConvertTo-SecureString -String $newUserPasswordText -AsPlainText -Force

$certificatePasswordText = "15pqw1"

$certificatePassword = ConvertTo-SecureString $certificatePasswordText -AsPlainText -Force

$restore = Restore-VEHANADatabase -Backup $backup -TargetServerName "saphana02" -TargetSystemName "HXE" -GuestCredential $guestCredential -ApplicationCredential $appCredential -TargetSystemUserPassword $newUserPassword -UseHttps -UseSSL -ClientCertificatePath "C:/Users/Admin/Desktop/certificate.pfx" ClientCertificatePassword $certificatePassword

Perform the following steps:

  1. Run the Get-VEHANARestoreSession cmdlet. Save the result to the $session variable.

The cmdlet will return an array of restore sessions. Note the ordinal number of the necessary restore session. In our example, it is the first restore session in the array.

  1. Run the Get-VEHANASystem cmdlet. Set the first restore session in the $session variable as the Session parameter value.
  2. Run the Get-VEHANADatabase cmdlet and set the $system variable as the System parameter value. Select the necessary database returned by this command and save it to the $database variable. In our example, it is the first database in the array.
  3. Run the Get-VEHANABackupCatalogItem cmdlet and set the $database variable as the Database parameter value. Select the necessary backup returned by this command and save it to the $backup variable. In our example, it is the third backup in the array.
  4. Run the Get-Credential cmdlet to create a credential object. Enter the OS (<sid>adm) user and password that will be used for authenticating to the target SAP HANA server. Save the result to the $guestCredential variable.
  5. Run the Get-Credential cmdlet to create a credential object. Enter the database user account and password that will be used for authenticating to the target SAP HANA system. Save the result to the $appCredential variable.
  6. Declare the $newUserPasswordText variable and assign to it the password for the new SYSTEM database user created for the restored database.
  7. Run the ConvertTo-SecureString cmdlet. Set the $newUserPasswordText variable as the String parameter value. Provide the AsPlainText and Force parameters. Save the result to the $newUserPassword variable.
  8. Declare the $certificatePasswordText variable and assign to it the password for the new SYSTEM database user created for the restored database.
  9. Run the ConvertTo-SecureString cmdlet. Set the $certificatePasswordText variable as the String parameter value. Provide the AsPlainText and Force parameters. Save the result to the $certificatePassword variable.
  10. Run the Restore-VEHANADatabase cmdlet. Specify the following options:
  • Set the $backup variable as the Backup parameter value.
  • Specify the TargetServerName parameter value.
  • Specify the TargetSystemName parameter value.
  • Set the $guestCredential variable as the GuestCredential parameter value.
  • Set the $appCredential variable as the ApplicationCredential parameter value.
  • Set the $newUserPassword variable as the TargetSystemUserPassword parameter value.
  • Provide the UseHttps parameter.
  • Provide the UseSSL parameter.
  • Specify the ClientCertificatePath parameter value.
  • Set the $certificatePassword variable as the ClientCertificatePassword parameter value.

Save the result to the $restore variable to be able to use it with other cmdlets.

Related Commands

Page updated 7/9/2024

Page content applies to build 12.2.0.334