Data Backup and Recovery Discussions

Scheduling clones in PowerShell

borismekler

I need to clone a set of databases from one SQL instance to another, and refresh them every 6 hours. Right now I'm doing it with SnapManager for SQL, but I'm trying to migrate it to SnapCenter. It looks like GUI will only let me schedule one database at a time, which is not optimal when I have eight of them sharing a LUN. With PowerShell, I almost have it - it clones all the DBs I need, but only once - I need to add the 'refresh every 6 hours' part. What I have right now is:

 

Add-SmCloneJob -CloneJobName SQL_clone_to_reports -PluginCode SMSQL -CloneToInstance 'SQL2\REPORT' -CloneToHost sql2.domain.local -Resources @{'Host'='sql1.domain.local';'Type'='SQL Database';'Names'='SQL1\PROD\DB1,SQL1\PROD\DB2,SQL1\PROD\DB3,SQL1\PROD\DB4,SQL1\PROD\DB5,SQL1\PROD\DB6,SQL1\PROD\DB7,SQL1\PROD\DB8'} -AutoAssignMountPoint

However, when I try to add '-schedules' to the command, I just get syntax errors. What's the proper format to have it run at 3:30 AM, 9:30 AM, 3:30 PM and 9:30 PM?

 

Thank you.

1 ACCEPTED SOLUTION

donny_lang

From page 15 of the SnapCenter Cmdlet Reference Guide (emphasis mine):

 

Schedules - Specifies in a hastable the schedule for the
clone job, including the policy name and the
schedule type. For example, -Schedules
@{"PolicyName"="BackupPolicy";"ScheduleType"="OneTime"}
You can specify multiple schedules in a comma separated list.

 

Here's the link to the guide, just for reference:  https://library.netapp.com/ecm/ecm_get_file/ECMLP2840881

 

Donny

View solution in original post

3 REPLIES 3

donny_lang

From page 15 of the SnapCenter Cmdlet Reference Guide (emphasis mine):

 

Schedules - Specifies in a hastable the schedule for the
clone job, including the policy name and the
schedule type. For example, -Schedules
@{"PolicyName"="BackupPolicy";"ScheduleType"="OneTime"}
You can specify multiple schedules in a comma separated list.

 

Here's the link to the guide, just for reference:  https://library.netapp.com/ecm/ecm_get_file/ECMLP2840881

 

Donny

View solution in original post

borismekler

I found my problem - I was trying to set the start date in my system default format of DD/MM/YYYY, while SnapCenter expects the American format of MM/DD/YYYY. Adding the following seems to have done the trick:

 

-Schedules @{'PolicyName'='03:30';'ScheduleType'='Daily';'StartTime'='07/27/2019 03:30 AM'},@{'PolicyName'='09:30';'ScheduleType'='Daily';'StartTime'='07/26/2019 09:30 AM'},@{'PolicyName'='15:30';'ScheduleType'='Daily';'StartTime'='07/26/2019 03:30 PM'},@{'PolicyName'='21:30';'ScheduleType'='Daily';'StartTime'='07/26/2019 09:30 PM'}

One last thing that I can't quite figure out is where can I see the properties for this job? Aside from the resulting clones, it doesn't seem to show up anywhere in the GUI, and running  "Get-SmCloneJob -PluginCode SMSQL -Resource @{'Host'='sql1.domain.local';'Type'='SQL Database';'Names'='SQL1\PROD\DB1'}" returns just CloneJobName and ResourceName. Am I missing something somewhere, or am I supposed to keep track of this separately from SnapCenter?

donny_lang

If you run:

Get-SmCloneJob | Get-Member

It'll show you all of the properties associated with the cmdlet. You may be able to get additional detail by selecting a property that isn't displayed by default. You can do that by running:

Get-SmCloneJob | Select-Object -Property <property name> 

or by capturing the command output in a variable and then using the "$variable.PropertyName" syntax to output the value of a single property. 

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public