backup help using ola hallengren script on AG

Bob sql 436 Reputation points

Hi All,

Need some help on OLA Hallengren's backup stored procedure.

We have an 2-node ALWAYS ON setup (node1- primary , node2 - secondary)
The credential is setup with name "ProdBackupCredential" which has access key for storage account

We have 2 databases which are around 3.5TB in size and want to take a stripped backups with 8 files each.

SQL Version:

Microsoft SQL Server 2017 (RTM-CU23) (KB5000685) - 14.0.3381.3 (X64) Feb 9 2021 12:08:50 Copyright (C) 2017 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2019 Datacenter 10.0 <X64> (Build 17763: ) (Hypervisor)

I want my backups to happen only on SECONDARY replica(node2 per say) not on PRIMARY.
For this, we already set the backup preferences as Prefer Secondary and weight as node1-50%,node2-50%

2 questions.


  1. Which version of Ola Hallengren supports, Alwayson Secondary backups
  2. Is there any option do I need to add in the below backup cmd.
    (also, any node can be acting as primary or secondary based on failover scenarios)
    I'll be creating same backup job on both nodes but my backup should only run on SECONDARY.
    In that case, how does my command look like?? what options do I need to add in the below backup cmd?

--sample backup command
use master
EXECUTE dbo.DatabaseBackup
@Databases = 'USER_DATABASES,db1,db2',
@URL = '', --storage aant and container
@Credential = ProdBackupCred, --credential which we have created
@BackupType = 'FULL', -- want to take Full backup for db1 and db2
@Compress = 'Y', -- take compress backup
@NumberOfFiles = 8, --stripped backup
@Verify = 'N' -- no need to verify this backup

Kind Regards,

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
27,025 questions
0 comments No comments
{count} votes

0 additional answers

Sort by: Most helpful