Back up resources using PowerShell cmdlets

Contributors netapp-nsriram netapp-soumikd netapp-asubhas Download PDF of this page

Backing up a resource includes establishing a connection with the SnapCenter Server, adding resources, adding a policy, creating a backup resource group, and backing up.

What you will need

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

  • You must have added the storage system connection and created a credential.

About this task

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

Steps

  1. Initiate a connection session with the SnapCenter Server for a specified user by using the Open-SmConnection cmdlet.

    Open-smconnection  -SMSbaseurl  https:\\snapctr.demo.netapp.com:8146\

    The username and password prompt is displayed.

  2. Add resources by using the Add-SmResources cmdlet.

    This example adds resources:

    Add-SmResource -HostName '10.232.206.248' -PluginCode 'DB2' -ResourceName NONREC1 -ResourceType Database -StorageFootPrint ( @
    {"VolumeName"="DB2_NONREC1DB";"LunName"="DB2_NONREC1DB";"Vserver"="vserver_scauto_secondary"}) -Instance db2inst1
  3. Create a backup policy by using the Add-SmPolicy cmdlet.

    This example creates a new backup policy:

    Add-SMPolicy -PolicyName 'db2VolumePolicy' -PolicyType 'Backup' -PluginPolicyType DB2  -description 'VolumePolicy'
  4. Add a new resource group to SnapCenter by using the Add-SmResourceGroup cmdlet.

    This example creates a new resource group with the specified policy and resources:

    Add-SmResourceGroup -ResourceGroupName 'Verify_ManualBackup_DatabaseLevel_MultipleVolume_unix' -Resources @(@
    {"Host"="10.232.206.248";"Uid"="db2inst2\NONREC"},@{"Host"="10.232.206.248";"Uid"="db2inst1\NONREC"}) -Policies db2ManualPolicy
  5. Initiate a new Snapshot copy job by using the New-SmBackup cmdlet.

    New-SMBackup -DatasetName Verify_ManualBackup_DatabaseLevel_MultipleVolume_unix -Policy db2ManualPolicy
  6. View the status of the backup job by using the Get-SmBackupReport cmdlet.

    This example displays a job summary report of all jobs that were run on the specified date:

    PS C:\> Get-SmBackupReport -JobId 351
    Output:
    BackedUpObjects           : {DB1}
    FailedObjects             : {}
    IsScheduled               : False
    HasMetadata               : False
    SmBackupId                : 269
    SmJobId                   : 2361
    StartDateTime             : 10/4/2016 11:20:45 PM
    EndDateTime               : 10/4/2016 11:21:32 PM
    Duration                  : 00:00:46.2536470
    CreatedDateTime           : 10/4/2016 11:21:09 PM
    Status                    : Completed
    ProtectionGroupName       : Verify_ASUP_Message_windows
    SmProtectionGroupId       : 211
    PolicyName                : test2
    SmPolicyId                : 20
    BackupName                : Verify_ASUP_Message_windows_scc54_10-04-2016_23.20.46.2758
    VerificationStatus        : NotVerified
    VerificationStatuses      :
    SmJobError                :
    BackupType                : SCC_BACKUP
    CatalogingStatus          : NotApplicable
    CatalogingStatuses        :
    ReportDataCreatedDateTime :