This repository contains solutions to properly control and maintain scheduled jobs on SQL Servers with either Availability Groups or Database Mirroring.
This solution is an improved version of the scripts provided at Automatically Enable or Disable Jobs Based on HADR Role.
The relevant scripts for Availability Groups are provided in the availability-groups folder.
The relevant scripts for Database Mirroring are provided in the database-mirroring folder.
This repository also contains the "classic" versions of the scripts, provided in the classic folder.
This solution is released under the MIT License, and is provided "as-is", as a free contribution to the professional SQL Server community.
This is an open-source solution. Please feel free to [create issues]({{ site.github.repository_url }}/issues) if you want to submit bug reports or feature requests.
You may also fork the solution to your account and submit pull requests if you want to contribute!