Skip to main content
SnapCenter Software 4.6
A newer release of this product is available.

Clone backups using PowerShell cmdlets

Contributors netapp-soumikd

The clone workflow includes planning, performing the clone operation, and monitoring the operation.

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

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
  2. List the backups that can be cloned by using the Get-SmBackup or Get-SmResourceGroup cmdlet.

    This example displays information about all available backups:

    C:\PS>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

    This example displays information about a specified resource group, its resources, and associated policies:

    PS C:\> Get-SmResourceGroup -ListResources –ListPolicies
    
    Description :
    CreationTime : 8/4/2015 3:44:05 PM
    ModificationTime : 8/4/2015 3:44:05 PM
    EnableEmail : False
    EmailSMTPServer :
    EmailFrom :
    EmailTo :
    EmailSubject :
    EnableSysLog : False
    ProtectionGroupType : Backup
    EnableAsupOnFailure : False
    Policies : {FinancePolicy}
    HostResourceMaping : {}
    Configuration : SMCoreContracts.SmCloneConfiguration
    LastBackupStatus :
    VerificationServer :
    EmailBody :
    EmailNotificationPreference : Never
    VerificationServerInfo : SMCoreContracts.SmVerificationServerInfo
    SchedulerSQLInstance :
    CustomText :
    CustomSnapshotFormat :
    SearchResources : False
    ByPassCredential : False
    IsCustomSnapshot :
    MaintenanceStatus : Production
    PluginProtectionGroupTypes : {SMSQL}
    Name : Payrolldataset
    Type : Group
    Id : 1
    Host :
    UserName :
    Passphrase :
    Deleted : False
    Auth : SMCoreContracts.SmAuth
    IsClone : False
    CloneLevel : 0
    ApplySnapvaultUpdate : False
    ApplyRetention : False
    RetentionCount : 0
    RetentionDays : 0
    ApplySnapMirrorUpdate : False
    SnapVaultLabel :
    MirrorVaultUpdateRetryCount : 7
    AppPolicies : {}
    Description : FinancePolicy
    PreScriptPath :
    PreScriptArguments :
    PostScriptPath :
    PostScriptArguments :
    ScriptTimeOut : 60000
    DateModified : 8/4/2015 3:43:30 PM
    DateCreated : 8/4/2015 3:43:30 PM
    Schedule : SMCoreContracts.SmSchedule
    PolicyType : Backup
    PluginPolicyType : SMSQL
    Name : FinancePolicy
    Type :
    Id : 1
    Host :
    UserName :
    Passphrase :
    Deleted : False
    Auth : SMCoreContracts.SmAuth
    IsClone : False
    CloneLevel : 0
    clab-a13-13.sddev.lab.netapp.com
    DatabaseGUID :
    SQLInstance : clab-a13-13
    DbStatus : AutoClosed
    DbAccess : eUndefined
    IsSystemDb : False
    IsSimpleRecoveryMode : False
    IsSelectable : True
    SqlDbFileGroups : {}
    SqlDbLogFiles : {}
    AppFileStorageGroups : {}
    LogDirectory :
    AgName :
    Version :
    VolumeGroupIndex : -1
    IsSecondary : False
    Name : TEST
    Type : SQL Database
    Id : clab-a13-13\TEST
    Host : clab-a13-13.sddev.mycompany.com
    UserName :
    Passphrase :
    Deleted : False
    Auth : SMCoreContracts.SmAuth
    IsClone : False
  3. Initiate a clone operation from an existing backup by using the New-SmClone cmdlet.

    This example creates a clone from a specified backup with all logs:

    PS C:\> New-SmClone
    -BackupName payroll_dataset_vise-f3_08-05-2015_15.28.28.9774
    -Resources @{"Host"="vise-f3.sddev.mycompany.com";
    "Type"="SQL Database";"Names"="vise-f3\SQLExpress\payroll"}
    -CloneToInstance vise-f3\sqlexpress -AutoAssignMountPoint
    -Suffix _clonefrombackup
    -LogRestoreType All -Policy clonefromprimary_ondemand
    
    PS C:> New-SmBackup -ResourceGroupName PayrollDataset -Policy FinancePolicy

    This example creates a clone to a specified Microsoft SQL Server instance:

    PS C:\> New-SmClone
    -BackupName "BackupDS1_NY-VM-SC-SQL_12-08-2015_09.00.24.8367"
    -Resources @{"host"="ny-vm-sc-sql";"Type"="SQL Database";
    "Names"="ny-vm-sc-sql\AdventureWorks2012_data"}
    -AppPluginCode SMSQL -CloneToInstance "ny-vm-sc-sql"
    -Suffix _CLPOSH -AssignMountPointUnderPath "C:\SCMounts"
  4. View the status of the clone job by using the Get-SmCloneReport cmdlet.

    This example displays a clone report for the specified job ID:

    PS C:\> Get-SmCloneReport -JobId 186
    
    SmCloneId : 1
    SmJobId : 186
    StartDateTime : 8/3/2015 2:43:02 PM
    EndDateTime : 8/3/2015 2:44:08 PM
    Duration : 00:01:06.6760000
    Status : Completed
    ProtectionGroupName : Draper
    SmProtectionGroupId : 4
    PolicyName : OnDemand_Clone
    SmPolicyId : 4
    BackupPolicyName : OnDemand_Full_Log
    SmBackupPolicyId : 1
    CloneHostName : SCSPR0054212005.mycompany.com
    CloneHostId : 4
    CloneName : Draper__clone__08-03-2015_14.43.53
    SourceResources : {Don, Betty, Bobby, Sally}
    ClonedResources : {Don_DRAPER, Betty_DRAPER, Bobby_DRAPER,
                       Sally_DRAPER}

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.