Restoring and recovering resources using PowerShell cmdlets

Restoring and recovering a SQL Server database or Windows file system 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

The information regarding the parameters that can be used with the cmdlet and their descriptions can be obtained by runningGet-Help command_name. Alternatively, you can also refer to the Cmdlet Reference Guide.

SnapCenter Software 4.2 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. Retrieve the information about the one or more backups that you want to restore by using the Get-SmBackup and Get-SmBackupReport cmdlets.
    Example

    This example displays information about all available backups:

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

    This example displays detailed information about the backup Secondary_SCSPR0019366001_01-15-2015_06.49.08:

    PS C:\> Get-SmBackupReport 
    -BackupName Secondary_SCSPR0019366001_01-15-2015_06.49.08
    
    BackedUpObjects : {TestDB1, TestDB2, TestDB3, TestDB4...}
    FailedObjects : {}
    BackupType : Full Backup
    IsScheduled : False
    SmBackupId : 52
    SmJobId : 585
    StartDateTime : 1/15/2015 6:49:07 AM
    EndDateTime : 1/15/2015 6:49:21 AM
    Duration : 00:00:13.8370000
    CreatedDateTime : 1/15/2015 6:49:18 AM
    Status : Completed
    ProtectionGroupName : Secondary
    SmProtectionGroupId : 5
    PolicyName : Vault
    SmPolicyId : 18
    BackupName : Secondary_SCSPR0019366001_01-15-2015_06.49.08
    VerificationStatus : NotVerified
    
  3. Restore data from the backup by using the Restore-SmBackup cmdlet.
    Example
    C:\PS>PS C:\> Restore-SmBackup -PluginCode SCSQL 
    -AppObjectId 'vise-f6\PayrollDatabase' 
    -BackupName 'NetApp_PayrollDataset_Backup Policy_
                 vise-f6_NetApp_08-07-2015_08.48.59.6962' 
    -RestoreWhenOnline
    
     Name                : Restore 'vise-f6\PayrollDatabase'
     Id                  : 199
     StartTime           : 8/7/2015 9:21:36 AM
     EndTime             :
     IsCancellable       : False
     IsRestartable       : False
     IsCompleted         : False
     IsVisible           : False
     IsScheduled         : False
     PercentageCompleted : 0
     Description         :
     Status              : Queued
     Owner               :
     Error               :
     Priority            : None
     Tasks               : {}
     ParentJobID         : 0
     EventId             : 0
    
    Example
    Restore-SmBackup -PluginCode SCSQL -AppObjectId 'scspr0270378001\abc' -BackupName 'sc
    spr0270378001_abc_scspr0270378001_07-25-2017_04.51.10.5795' -AlternatePath @{Source='D:\data\abc.mdf';Destinatio
    n='D:\data\bharathaewf123.mdf'},@{Source='D:\log\bharath_log.ldf';Destination='D:\log\bharathaef_log123.ldf'} -SQLInstan
    ceName 'scspr0273089004' -DatabaseName 'abc123adwqa1231' -ExistingFiles