Restoring SAP HANA database using PowerShell cmdlets

Restoring a SAP HANA database backup includes initiating a connection session with the SnapCenter Server, listing the backups and retrieving backup information, and restoring a backup.

Before you begin

You must have prepared the PowerShell environment to execute the PowerShell cmdlets.

About this task

For information about PowerShell cmdlets, use the SnapCenter cmdlet help or see the cmdlet reference information.

SnapCenter Software 4.0 Windows Cmdlet Reference Guide

Steps

  1. Initiate a connection session with the SnapCenter Server for a specified user by using the Open-SmConnection cmdlet.
    Example
    Open-smconnection  -SMSbaseurl  https:\\snapctr.demo.netapp.com:8146/
    
  2. Identify the backup that you want to restore by using the Get-SmBackup and Get-SmBackupReport cmdlets.
    Example

    This example shows that there are two backups available for the restore:

     C:\PS>PS C:\> Get-SmBackup
           
            BackupId                      BackupName                    BackupTime                    BackupType
            --------                      ----------                    ----------                    ----------
             1                     Payroll Dataset_vise-f6_08... 8/4/2015 11:02:32 AM          Full Backup
             2                     Payroll Dataset_vise-f6_08... 8/4/2015 11:23:17 AM
    
    
    Example

    This example displays detailed information about the backup from January 29th 2015 to February 3rd, 2015:

    PS C:\> Get-SmBackupReport -FromDateTime "1/29/2015" -ToDateTime "2/3/2015"
    
    SmBackupId           : 113
       SmJobId              : 2032
       StartDateTime        : 2/2/2015 6:57:03 AM
       EndDateTime          : 2/2/2015 6:57:11 AM
       Duration             : 00:00:07.3060000
       CreatedDateTime      : 2/2/2015 6:57:23 AM
       Status               : Completed
       ProtectionGroupName  : Clone
       SmProtectionGroupId  : 34
       PolicyName           : Vault
       SmPolicyId           : 18
       BackupName           : Clone_SCSPR0019366001_02-02-2015_06.57.08
       VerificationStatus   : NotVerified
    
       SmBackupId           : 114
       SmJobId              : 2183
       StartDateTime        : 2/2/2015 1:02:41 PM
       EndDateTime          : 2/2/2015 1:02:38 PM
       Duration             : -00:00:03.2300000
       CreatedDateTime      : 2/2/2015 1:02:53 PM
       Status               : Completed
       ProtectionGroupName  : Clone
       SmProtectionGroupId  : 34
       PolicyName           : Vault
       SmPolicyId           : 18
       BackupName           : Clone_SCSPR0019366001_02-02-2015_13.02.45
       VerificationStatus   : NotVerified
    
  3. Start the recovery process in the HANA studio.
    The database is shut down.
  4. Restore data from the backup by using the Restore-SmBackup cmdlet.
    Note: AppObjectId is "Host"\Plugin\UID, where UID = SID is for single container type resource and UID = SID\TenantDatabaseName is for multiple containers resource. You can get the ResourceID from the Get-smResources cmdlet.
    Get-smResources  -HostName cn24.sccore.test.com  -PluginCode HANA
    Example

    This example shows how to restore the database from the primary storage:

    Restore-SmBackup -PluginCode HANA -AppObjectId cn24.sccore.test.com\hana\H10 -BackupId 3
    
    Example

    This example shows how to restore the database from the secondary storage:

    Restore-SmBackup -PluginCode 'HANA' -AppObjectId cn24.sccore.test.com\hana\H10 -BackupId 399 -Confirm:$false  -Archive @( @{"Primary"="<Primary Vserver>:<PrimaryVolume>";"Secondary"="<Secondary Vserver>:<SecondaryVolume>"})
    
    The backups will be available in HANA studio for recovery.