Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from Mar 4 '14 at 14:24

This question came from our site for professional and enthusiast programmers.

up vote 22 down vote accepted

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.

share|improve this answer
Thanks for chiming in and confirming. Appreciate your excellent scripts :-) – Kin Mar 4 '14 at 19:25
Do you really think you're qualified to speak on this matter? ;) – billinkc Mar 4 '14 at 19:25
Can someone verify the authenticity of this user? – Kermit Mar 4 '14 at 19:33
@OlaHallengren - sorry for the misunderstanding. We were just so excited to see you here that we turned into primary school kids. – swasheck Mar 5 '14 at 15:14
@swasheck Speak for yourself, but I was more excited than a little school girl. – Kermit Mar 5 '14 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:

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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