Skip to main content
SnapCenter Software 6.0

Clone from a SQL Server database backup

Contributors netapp-nsriram netapp-soumikd netapp-asubhas

You can use SnapCenter to clone a SQL Server database backup. If you want to access or restore an older version of the data, you can clone database backups on demand.

Before you begin
  • You should have prepared for data protection by completing tasks such as adding hosts, identifying resources, and creating storage system connections.

  • You should have backed up databases or resource groups.

  • The protection type such as mirror, vault, or mirror-vault for data LUN and log LUN should be same to discover secondary locators during cloning to an alternate host using log backups.

  • If the mounted clone drive cannot be found during a SnapCenter clone operation, you should change the CloneRetryTimeout parameter of SnapCenter Server to 300.

  • You should ensure that the aggregates hosting the volumes should be in the assigned aggregates list of the storage virtual machine (SVM).

About this task
  • While cloning to a standalone database instance, ensure that the mount point path exists and it is a dedicated disk.

  • While cloning to a Failover Cluster Instance (FCI), ensure that the mount points exists, it is a shared disk, and the path and the FCI should belong to the same SQL resource group.

  • Ensure that there is only one vFC or FC initiator attached to each host. This is because, SnapCenter supports only one initiator per host.

  • If the source database or the target instance is on a cluster shared volume (csv), then the cloned database will be on the csv.

  • The SCRIPTS_PATH is defined using the PredefinedWindowsScriptsDirectory key located in the SMCoreServiceHost.exe.Config file of the plug-in host.

    If needed, you can change this path and restart SMcore service. It is recommended that you use the default path for security.

    The value of the key can be displayed from swagger through the API: API /4.7/configsettings

    You can use the GET API to display the value of the key. SET API is not supported.

Note For virtual environments (VMDK/RDM), ensure that the mount point is a dedicated disk.
  • For ONTAP 9.12.1 and below version, the clones created from the SnapLock Vault Snapshots as part of restore will inherit the SnapLock Vault expiry time. Storage admin should manually cleanup the clones post the SnapLock expiry time.

SnapCenter UI
Steps
  1. In the left navigation pane, select Resources, and then select SnapCenter Plug-in for SQL Server from the list.

  2. In the Resources page, select either Database or Resource Group from the View list.

    Note Cloning of a backup of an instance is not supported.
  3. Select the database or resource group.

  4. From the Manage Copies view page, select the backup either from primary or secondary (mirrored or vaulted) storage system.

  5. Select the backup, and then select clone icon.

  6. In the Clone Options page, perform the following actions:

    For this field…​ Do this…​

    Clone server

    Choose a host on which the clone should be created.

    Clone instance

    Choose a clone instance to which you want to clone the database backup.

    This SQL instance must be located in the specified clone server.

    Clone suffix

    Enter a suffix that will be appended to the clone file name to identify that the database is a clone.

    For example, db1_clone. If you are cloning to the same location as the original database, you must provide a suffix to differentiate the cloned database from the original database. Otherwise, the operation fails.

    Auto assign mount point or Auto assign volume mount point under path

    Choose whether to automatically assign a mount point or a volume mount point under a path.

    Auto assign volume mount point under path: The mount point under a path allows you to provide a specific directory. The mount points will be created within that directory. Before you choose this option, you must ensure that the directory is empty. If there is a database in the directory, the database will be in an invalid state after the mount operation.

  7. In the Logs page, select one of the following options:

    For this field…​ Do this…​

    None

    Choose this option when you want to clone only the full backup without any logs.

    All log backups

    Choose this option to clone all the available log backups dated after the full backup.

    By log backups until

    Choose this option to clone the database based on the backup logs that were created up to the backup log with the selected date.

    By specific date until

    Specify the date and time after which the transaction logs are not applied to the cloned database.

    This point-in-time clone halts the clone of the transaction log entries that were recorded after the specified date and time.

  8. In the Script page, enter the script timeout, path, and the arguments of the prescript or postscript that should be run before or after the clone operation, respectively.

    For example, you can run a script to update SNMP traps, automate alerts, send logs, and so on.

    Note The prescripts or postscripts path should not include drives or shares. The path should be relative to the SCRIPTS_PATH.

    The default script timeout is 60 seconds.

  9. In the Notification page, from the Email preference drop-down list, select the scenarios in which you want to send the emails.

    You must also specify the sender and receiver email addresses, and the subject of the email. If you want to attach the report of the clone operation performed, select Attach Job Report.

    Note For email notification, you must have specified the SMTP server details using the either the GUI or the PowerShell command Set-SmSmtpServer.

    For EMS, you can refer to Manage EMS data collection

  10. Review the summary, and then select Finish.

  11. Monitor the operation progress by selecting Monitor > Jobs.

After you finish

After the clone is created, you should never rename it.

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.