I am about to setup Ola Hallengrens database maintenance plan. We have our database mirrored and I was just wanting to know if I need to run the script on both my Sql Server instances or only the primary?


2 Answers 2


I recommend that you have the jobs enabled and scheduled on both servers and with the same configurations. Databases that are in a mirror role will automatically be skipped. There are checks for that in the script.

  • 5
    Thanks for chiming in and confirming. Appreciate your excellent scripts :-)
    – Kin Shah
    Mar 4, 2014 at 19:25
  • 7
    Do you really think you're qualified to speak on this matter? ;)
    – billinkc
    Mar 4, 2014 at 19:25
  • 1
    Do you even exist? I've always thought you're just a brilliant bunch of maintenance scripts :-).
    – Marian
    Mar 5, 2014 at 9:05
  • 4
    @OlaHallengren - sorry for the misunderstanding. We were just so excited to see you here that we turned into primary school kids.
    – swasheck
    Mar 5, 2014 at 15:14
  • 3
    @swasheck Speak for yourself, but I was more excited than a little school girl.
    – Kermit
    Mar 5, 2014 at 15:18

For now just run it on the Primary database server.

When you do a failover, you can run it on the mirrored server.

e.g when you deploy it on mirrored server, you (refer to: http://ola.hallengren.com/sql-server-backup.html)

EXECUTE dbo.DatabaseBackup
@Databases = 'SYSTEM_DATABASES', -- when failover, change it to ALL
@Directory = 'C:\Backup',
@BackupType = 'LOG',
@Verify = 'Y',
@ChangeBackupType = 'Y',
@CleanupTime = 24

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.