I'm new to AlwaysOn Availability groups and have set it up in my DEV environment. I currently have it set to do the backups on my primary because we are only using the secondary for read-only reporting purposes. The backups are running but how do I control how often? Currently it does a FULL every night, a DIFF every night at midnight and log backups every hour. I don't see in the AVG setup where to specify how often...I currently do a FULL at 10pm, DIFF every 4 hours and LOG every 15 minutes. I also currently use Ola's backup scripts and I'm confused about how to continue to use his scripts when I setup AVG in my production. I've read that there is a parameter AVAILABILITY_GROUP_DATABASES for Ola's scripts. Do I use this to be able to control all the backups with Ola's scripts? And then the AVG will not back up the databases...instead they will be controlled by Ola's scripts?

I've tried testing this and no matter what I do, the AVG always does the backups and Ola's scripts are ignored.

  • Have you configured the sql server jobs of ola in a schedule? Can you check the output of the dbo.Commandlog table in the database where you put the ola hallengren scripts? Feb 13, 2018 at 0:35
  • Yes I have. I checked the dbo.Commandlog table and see entries backing up the database and logs to the SQLAVGDEV path and not the regular paths that my backups usually go to. But why do I need to copy these jobs to my secondary as well? Feb 14, 2018 at 19:16

1 Answer 1


I am running Availability Groups and using Ola's backup solution, and here is how I have it set up:

  1. First, Availability Groups do not do their own backups, something has to be scheduled to run a backup. So make sure there is not a Maintenance Plan already doing backups on the SQL Server
  2. Make sure Ola's scripts are installed and up to date on all of your Availability Group servers. :)
  3. Create a SQL Agent job for your FULL backups that calls Ola's dbo.DatabaseBackup procedure; schedule this to run however often you need.
  4. Repeat step 3 for your DIFF and LOG backups.
  5. Copy the backup jobs you just created to all of your secondary Availability Group servers.

Here's what you need to know about Ola's scripts:

  • They are what I like to refer to as "Availability Group Aware", meaning that you can run the same backup jobs on both your Primary and Secondary AG servers, and they will act accordingly. (ex: If you run a FULL backup on a Secondary, Ola's script will recognize it is on a secondary and exit gracefully without doing anything)
  • If you specify ALL_AVAILABILITY_GROUPS as your backup database, it will backup only the databases in ALL of the availability groups on that server. If you specify USER_DATABASES, it will back up ALL user databases on the server (including the ones in the AG).
  • ah...that you for that clarification. A couple of questions...I do have Ola's backups running but they are not going to the path specified but instead to a folder called DEV_Replication@SQDLAVGDEV. So if my backups are being run by Ola's script, then why aren't they kicking off at the right times. It's setup to backup logs every 15 mins but now they are every hour? and why do I need to copy the backup jobs to the secondary too? I appreciate your comments! :-) Feb 13, 2018 at 21:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.