Custom Schedules for SnapCenter Jobs

A bit of a random post.

Say you find the inbuilt scheduler in SnapCenter is a little bit limiting. For example:

You want to do 22 hourly logs backups at every hour from 0200 to 2300, and 1 daily full & logs backup at 0000. The full & logs backup might take over an hour to run.

- you can’t do that with the inbuilt SnapCenter scheduler, but...

If you use the Windows inbuilt Task Scheduler on the SnapCenter server, and configure OnDemand Snapcenter policies, you can configure the Windows Task Scheduler to kick off OnDemand SnapCenter backups on a schedule!

A proof that it works (have a look at this post for how to setup a scheduled task):

1) We have an Exchange Server Backup Policy set to keep 7 on-demand snapshot copies.
Note: I could set the on-demand retention to say 7 days, but this is a lab and it’s easy and quick to run 8 on-demand backups jobs and see if the retention is indeed 7, rather than having to wait 8 days to prove a point.

Image: Exchange Server Backup Policy

2) We have a Resource Group with the on-demand policy.

Image: Resource group for DB5 on MB3 with ON_DEMAND policy

3) To prove it works, we on-demand backup the resource group 8 times (waiting for ‘Status = Completed’ each time).


PS> New-SMBackup -ResourceGroupName DB5_MB3_ONDEMAND -Policy ON_DEMAND | FT Name,Id,StartTime
PS> New-SMBackup -ResourceGroupName DB5_MB3_ONDEMAND -Policy ON_DEMAND | FT Name,Id,StartTime
PS> New-SMBackup -ResourceGroupName DB5_MB3_ONDEMAND -Policy ON_DEMAND | FT Name,Id,StartTime
PS> New-SMBackup -ResourceGroupName DB5_MB3_ONDEMAND -Policy ON_DEMAND | FT Name,Id,StartTime
PS> New-SMBackup -ResourceGroupName DB5_MB3_ONDEMAND -Policy ON_DEMAND | FT Name,Id,StartTime
PS> New-SMBackup -ResourceGroupName DB5_MB3_ONDEMAND -Policy ON_DEMAND | FT Name,Id,StartTime
PS> New-SMBackup -ResourceGroupName DB5_MB3_ONDEMAND -Policy ON_DEMAND | FT Name,Id,StartTime
PS> New-SMBackup -ResourceGroupName DB5_MB3_ONDEMAND -Policy ON_DEMAND | FT Name,Id,StartTime

Name                                           Id StartTime
----                                           -- ---------
Backup of Resource Group 'DB5_MB3_ONDEMAND'... 2319 11/1/2019 2:29:35 PM

PS> (2310..2319 | Foreach{Get-SmJobSummaryReport -JobId $_}) | FT JobEndDateTime,JobName,Status -Autosize

JobEndDateTime       JobName                                        Status
--------------       -------                                        ------
11/1/2019 2:15:31 PM Create Policy 'ON_DEMAND'                      Completed
11/1/2019 2:17:00 PM Create Resource Group 'DB5_MB3_ONDEMAND'       Completed
11/1/2019 2:20:35 PM Backup of Resource Group 'DB5_MB3_ONDEMAND'... Completed
11/1/2019 2:21:15 PM Backup of Resource Group 'DB5_MB3_ONDEMAND'... Completed
11/1/2019 2:23:02 PM Backup of Resource Group 'DB5_MB3_ONDEMAND'... Completed
11/1/2019 2:24:12 PM Backup of Resource Group 'DB5_MB3_ONDEMAND'... Completed
11/1/2019 2:24:54 PM Backup of Resource Group 'DB5_MB3_ONDEMAND'... Completed
11/1/2019 2:25:43 PM Backup of Resource Group 'DB5_MB3_ONDEMAND'... Completed
11/1/2019 2:26:28 PM Backup of Resource Group 'DB5_MB3_ONDEMAND'... Completed
11/1/2019 2:30:06 PM Backup of Resource Group 'DB5_MB3_ONDEMAND'... Completed


4) And check we only have 7 snaphots as specified by our retention.

cluster2::> snapshot show -volume *DB5* -snapshot *ONDEMAND* -fields snapshot
vserver volume       snapshot
------- ------------ ---------------------------------------------
svm2    vol_N3DB4DB5 DB5_MB3_ONDEMAND_mb3_11-01-2019_14.20.57.5337
svm2    vol_N3DB4DB5 DB5_MB3_ONDEMAND_mb3_11-01-2019_14.22.40.9871
svm2    vol_N3DB4DB5 DB5_MB3_ONDEMAND_mb3_11-01-2019_14.23.48.7528
svm2    vol_N3DB4DB5 DB5_MB3_ONDEMAND_mb3_11-01-2019_14.24.35.4717
svm2    vol_N3DB4DB5 DB5_MB3_ONDEMAND_mb3_11-01-2019_14.25.15.7686
svm2    vol_N3DB4DB5 DB5_MB3_ONDEMAND_mb3_11-01-2019_14.26.10.6750
svm2    vol_N3DB4DB5 DB5_MB3_ONDEMAND_mb3_11-01-2019_14.29.35.8160
7 entries were displayed.


Idea proved!

Next steps: To write a little PowerShell script that you can run from a command prompt/scheduled task - that does what you want - test, and setup the Windows Scheduled Task as per requirements.

Comments

  1. I am doing something similar to this now with PS, but also taking clones of the mirror copy. Do you know how to give the snapshot a standardized name so that I can always clone the most recent snapshot? For example instead of the snapshot being named ResourceGroup_servername_date_time.guid_1 I want to always call it ResourceGroup_servername_recent_1

    ReplyDelete
    Replies
    1. Hi Starcrossed, is this for SnapCenter? If so, I don't think you can rename the snapshots without breaking the SnapCenter backups and restore functionality. If you're not using snapcenter, it is possible to rename the snapshots on the source system via powershell, so say your latest snapshot is always .1 on the DR system after snapmirror update (second oldest .2, 3rd oldest .3, etcetera.) Sometimes this snapshot naming convention is required for certain backup products.

      Delete

Post a Comment