Skip to main content
SnapCenter Software 6.0

Back up databases using PowerShell cmdlets

Contributors netapp-nsriram netapp-soumikd

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

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

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

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

    PS C:\> Open-SmConnection

    The username and password prompt is displayed.

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

    This example shows how to add a IBM Db2 instance:

    PS C:\> Add-SmResource -HostName 10.32.212.13 -PluginCode DB2 -ResourceType Instance -ResourceName db2inst1 -StorageFootPrint (@{"VolumeName"="windb201_data01";"LUNName"="windb201_data01";"StorageSystem"="scsnfssvm"}) -MountPoints "D:\"

    For Db2 Database:

    PS C:\> Add-SmResource -HostName 10.32.212.13 -PluginCode DB2 -ResourceType Database -ResourceName SALESDB -StorageFootPrint (@{"VolumeName"="windb201_data01";"LUNName"="windb201_data01";"StorageSystem"="scsnfssvm"}) -MountPoints "D:\" -Instance DB2
  3. Create a backup policy by using the Add-SmPolicy cmdlet.

  4. Protect the resource or add a new resource group to SnapCenter by using the Add-SmResourceGroup cmdlet.

  5. Initiate a new backup job by using the New-SmBackup cmdlet.

    This example shows how to backup a resource group:

    C:\PS> New-SMBackup -ResourceGroupName 'ResourceGroup_with_Db2_Resources' -Policy db2_policy1

    This example backs up a Db2 instance:

    C:\PS> New-SMBackup -Resources @{"Host"="10.32.212.13";"Uid"="DB2INST1";"PluginName"="DB2"} -Policy db2_policy

    This example backs up a Db2 database:

    C:\PS> New-SMBackup -Resources @{"Host"="10.32.212.13";"Uid"="DB2INST1\WINARCDB";"PluginName"="DB2"} -Policy db2_policy
  6. Monitor the job status (running, completed, or failed) by using the Get-smJobSummaryReport cmdlet.

    PS C:\> Get-SmJobSummaryReport -JobId 467
    
    SmJobId            : 467
    JobCreatedDateTime :
    JobStartDateTime   : 27-Jun-24 01:40:09
    JobEndDateTime     : 27-Jun-24 01:41:15
    JobDuration        : 00:01:06.7013330
    JobName            : Backup of Resource Group 'SCDB201WIN_RAVIR1_OPENLAB_NETAPP_LOCAL_DB2_DB2_WINCIR' with policy 'snapshot-based-db2'
    JobDescription     :
    Status             : Completed
    IsScheduled        : False
    JobError           :
    JobType            : Backup
    PolicyName         : db2_policy
    JobResultData      :
  7. Monitor the backup job details like backup ID, backup name to perform restore or clone operation by using the Get-SmBackupReport cmdlet.

    PS C:\> Get-SmBackupReport -JobId 467
    
    BackedUpObjects           : {WINCIR}
    FailedObjects             : {}
    IsScheduled               : False
    HasMetadata               : False
    SmBackupId                : 84
    SmJobId                   : 467
    StartDateTime             : 27-Jun-24 01:40:09
    EndDateTime               : 27-Jun-24 01:41:15
    Duration                  : 00:01:06.7013330
    CreatedDateTime           : 27-Jun-24 18:39:45
    Status                    : Completed
    ProtectionGroupName       : HOSTFQDN_DB2_DB2_WINCIR
    SmProtectionGroupId       : 23
    PolicyName                : db2_policy
    SmPolicyId                : 13
    BackupName                : HOSTFQDN _DB2_DB2_WINCIR_HOST_06-27-2024_01.40.09.7397
    VerificationStatus        : NotApplicable
    VerificationStatuses      :
    SmJobError                :
    BackupType                : SCC_BACKUP
    CatalogingStatus          : NotApplicable
    CatalogingStatuses        :
    ReportDataCreatedDateTime :
    PluginCode                : SCC
    PluginName                : DB2
    PluginDisplayName         : IBM DB2
    JobTypeId                 :
    JobHost                   : HOSTFQDN

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.