SlideShare uma empresa Scribd logo
1 de 16
Job Management in an
AlwaysOn World
How to handle jobs that need to run on the primary replica.
About Me…
• Database Administrator at Boulder County
• Twitter: @_KenWilson
• Blog: SQLBama.com
• LinkedIn: https://www.linkedin.com/in/sqlbama
Ken Wilson
Agenda
• Types of Jobs
• Job Failover Options
Job Types
• Active X
• Command Line
• PowerShell
OS
• Command Jobs
• Query JobsAnalysis Services
• Packages
• Maintenance Plans
Integration
Services
• Replication
• T-SQL StatementsSQL Server
So What Are My Options
• Add a job step
• Add a job server
• Move logic out of SQL Agent
• Use Alerts to enable/disable jobs
Adding a Job Step
• Add top level job step.
• Use logic to detect primary
• Continue Processing
• Exit Gracefully
• Possible Issues
 Detection could be tricky
 In 2012 you need to come up with the logic
yourself
 In 2014 and newer you can use the system
function sys.fn_hadr_is_primary_replica
 Misleading Error Log
• Active X
• Command Line
• PowerShell
OS
• Command Jobs
• Query Jobs
Analysis
Services
• Packages
• Maintenance Plans
Integration
Services
• Replication
• T-SQL StatementsSQL Server
Add Job Server
• Build a separate SQL Server
• Configure Job Server for Multi-Server
Administration
• Point Jobs at target servers
• Possible Issues
 Initial Setup
 Cost
• Active X
• Command Line
• PowerShell
OS
• Command Jobs
• Query Jobs
Analysis
Services
• Packages
• Maintenance Plans
Integration
Services
• Replication
• T-SQL StatementsSQL Server
Moving Logic
• Move primary detection logic out of the
SQL Agent Job
 Works well with T-SQL Statements and
OS job types
 Examples: Ola Hallengren’s Maintenance
Solution and MidnightDBA’s Minion
Backup Solution
• Possible Issues
 Need access to code
 Replication job types may be difficult to
setup.
• Active X
• Command Line
• PowerShell
OS
• Command Jobs
• Query Jobs
Analysis
Services
• Packages
• Maintenance Plans
Integration
Services
• Replication
• T-SQL StatementsSQL Server
Using Alerts
• Setup Alert on 1480 (AlwaysOn Role
Change)
• Setup Job to enable/disable other jobs
• Use the response of the alert to execute
the disable/enable job.
• Possible Issues
 Initial Setup a little more involved
 False positives are possible
• Active X
• Command Line
• PowerShell
OS
• Command Jobs
• Query Jobs
Analysis
Services
• Packages
• Maintenance Plans
Integration
Services
• Replication
• T-SQL StatementsSQL Server
To Recap…
• No one right way to manage jobs
• Document, Document, Document
References
• Michael Campbell’s Blog Series
 http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-1-
introduction
• SQL Agent Job Types
 https://msdn.microsoft.com/en-US/librAry/ms187056.aspx
• Minion Backup
 http://minionware.net/backup/
• Ola Halengren
 https://ola.hallengren.com/
Questions?
AlwaysOn Availability Group Job Management

Mais conteúdo relacionado

Mais procurados

Get Started with ASP.NET Core Training, Tutorial - Beginner to Advance
Get Started with ASP.NET Core Training, Tutorial - Beginner to AdvanceGet Started with ASP.NET Core Training, Tutorial - Beginner to Advance
Get Started with ASP.NET Core Training, Tutorial - Beginner to AdvanceShailendra Chauhan
 
How to Build Single Page HTML5 Apps that Scale
How to Build Single Page HTML5 Apps that ScaleHow to Build Single Page HTML5 Apps that Scale
How to Build Single Page HTML5 Apps that ScalePhil Leggetter
 
SPSNL17 - Be more effective with the PnP Provisioning Engine - Erwin van Hunen
SPSNL17 - Be more effective with the PnP Provisioning Engine - Erwin van HunenSPSNL17 - Be more effective with the PnP Provisioning Engine - Erwin van Hunen
SPSNL17 - Be more effective with the PnP Provisioning Engine - Erwin van HunenDIWUG
 
Connecticut Salesforce Developer Group - Jan 2017
Connecticut Salesforce Developer Group - Jan 2017Connecticut Salesforce Developer Group - Jan 2017
Connecticut Salesforce Developer Group - Jan 2017Jitendra Zaa
 
SharePoint Saturday San Antonio: Workflow 2013
SharePoint Saturday San Antonio: Workflow 2013SharePoint Saturday San Antonio: Workflow 2013
SharePoint Saturday San Antonio: Workflow 2013Sam Larko
 
JIRA Performance Testing in Pictures - Edward Bukoski Michael March
JIRA Performance Testing in Pictures - Edward Bukoski Michael MarchJIRA Performance Testing in Pictures - Edward Bukoski Michael March
JIRA Performance Testing in Pictures - Edward Bukoski Michael MarchAtlassian
 
Hire laravel-php-developers- Hire Laravel Programmers
Hire laravel-php-developers- Hire Laravel ProgrammersHire laravel-php-developers- Hire Laravel Programmers
Hire laravel-php-developers- Hire Laravel ProgrammersSummation IT
 
Signal r azurepresentation
Signal r azurepresentationSignal r azurepresentation
Signal r azurepresentationJustin Wendlandt
 
Best Practices for SharePoint Timer Jobs
Best Practices for SharePoint Timer JobsBest Practices for SharePoint Timer Jobs
Best Practices for SharePoint Timer JobsShailen Sukul
 
Office Online Server 2016 - a must for on-premises installation for SharePoin...
Office Online Server 2016 - a must for on-premises installation for SharePoin...Office Online Server 2016 - a must for on-premises installation for SharePoin...
Office Online Server 2016 - a must for on-premises installation for SharePoin...SPC Adriatics
 
Intro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NETIntro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NETAlan Hecht
 
Ultimate Free SQL Server Toolkit
Ultimate Free SQL Server ToolkitUltimate Free SQL Server Toolkit
Ultimate Free SQL Server ToolkitKevin Kline
 
Episode 9 - Building soap integrations in salesforce
Episode 9 - Building soap integrations  in salesforceEpisode 9 - Building soap integrations  in salesforce
Episode 9 - Building soap integrations in salesforceJitendra Zaa
 
SP24S053 Introduction to PowerShell for SharePoint Developers and Administrators
SP24S053 Introduction to PowerShell for SharePoint Developers and AdministratorsSP24S053 Introduction to PowerShell for SharePoint Developers and Administrators
SP24S053 Introduction to PowerShell for SharePoint Developers and AdministratorsMichael Blumenthal (Microsoft MVP)
 
Implementing Office Online Server
Implementing Office Online ServerImplementing Office Online Server
Implementing Office Online ServerThorbjørn Værp
 

Mais procurados (20)

Get Started with ASP.NET Core Training, Tutorial - Beginner to Advance
Get Started with ASP.NET Core Training, Tutorial - Beginner to AdvanceGet Started with ASP.NET Core Training, Tutorial - Beginner to Advance
Get Started with ASP.NET Core Training, Tutorial - Beginner to Advance
 
How to Build Single Page HTML5 Apps that Scale
How to Build Single Page HTML5 Apps that ScaleHow to Build Single Page HTML5 Apps that Scale
How to Build Single Page HTML5 Apps that Scale
 
SPSNL17 - Be more effective with the PnP Provisioning Engine - Erwin van Hunen
SPSNL17 - Be more effective with the PnP Provisioning Engine - Erwin van HunenSPSNL17 - Be more effective with the PnP Provisioning Engine - Erwin van Hunen
SPSNL17 - Be more effective with the PnP Provisioning Engine - Erwin van Hunen
 
Connecticut Salesforce Developer Group - Jan 2017
Connecticut Salesforce Developer Group - Jan 2017Connecticut Salesforce Developer Group - Jan 2017
Connecticut Salesforce Developer Group - Jan 2017
 
SharePoint Saturday San Antonio: Workflow 2013
SharePoint Saturday San Antonio: Workflow 2013SharePoint Saturday San Antonio: Workflow 2013
SharePoint Saturday San Antonio: Workflow 2013
 
JIRA Performance Testing in Pictures - Edward Bukoski Michael March
JIRA Performance Testing in Pictures - Edward Bukoski Michael MarchJIRA Performance Testing in Pictures - Edward Bukoski Michael March
JIRA Performance Testing in Pictures - Edward Bukoski Michael March
 
Hire laravel-php-developers- Hire Laravel Programmers
Hire laravel-php-developers- Hire Laravel ProgrammersHire laravel-php-developers- Hire Laravel Programmers
Hire laravel-php-developers- Hire Laravel Programmers
 
Signal r azurepresentation
Signal r azurepresentationSignal r azurepresentation
Signal r azurepresentation
 
Web without framework
Web without frameworkWeb without framework
Web without framework
 
Best Practices for SharePoint Timer Jobs
Best Practices for SharePoint Timer JobsBest Practices for SharePoint Timer Jobs
Best Practices for SharePoint Timer Jobs
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Office Online Server 2016 - a must for on-premises installation for SharePoin...
Office Online Server 2016 - a must for on-premises installation for SharePoin...Office Online Server 2016 - a must for on-premises installation for SharePoin...
Office Online Server 2016 - a must for on-premises installation for SharePoin...
 
SPSDC 2013 Building Solutions using SharePoint Timer Jobs
SPSDC 2013 Building Solutions using SharePoint Timer JobsSPSDC 2013 Building Solutions using SharePoint Timer Jobs
SPSDC 2013 Building Solutions using SharePoint Timer Jobs
 
Ow
OwOw
Ow
 
Intro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NETIntro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NET
 
SPSNJ 2013 Building Solutions using SharePoint TimerJobs
SPSNJ 2013 Building Solutions using SharePoint TimerJobsSPSNJ 2013 Building Solutions using SharePoint TimerJobs
SPSNJ 2013 Building Solutions using SharePoint TimerJobs
 
Ultimate Free SQL Server Toolkit
Ultimate Free SQL Server ToolkitUltimate Free SQL Server Toolkit
Ultimate Free SQL Server Toolkit
 
Episode 9 - Building soap integrations in salesforce
Episode 9 - Building soap integrations  in salesforceEpisode 9 - Building soap integrations  in salesforce
Episode 9 - Building soap integrations in salesforce
 
SP24S053 Introduction to PowerShell for SharePoint Developers and Administrators
SP24S053 Introduction to PowerShell for SharePoint Developers and AdministratorsSP24S053 Introduction to PowerShell for SharePoint Developers and Administrators
SP24S053 Introduction to PowerShell for SharePoint Developers and Administrators
 
Implementing Office Online Server
Implementing Office Online ServerImplementing Office Online Server
Implementing Office Online Server
 

Semelhante a AlwaysOn Availability Group Job Management

Rajnish singh(presentation on oracle )
Rajnish singh(presentation on  oracle )Rajnish singh(presentation on  oracle )
Rajnish singh(presentation on oracle )Rajput Rajnish
 
ETL for the masses with Power Query and M
ETL for the masses with Power Query and METL for the masses with Power Query and M
ETL for the masses with Power Query and MRégis Baccaro
 
Get Testing with tSQLt - SQL In The City Workshop 2014
Get Testing with tSQLt - SQL In The City Workshop 2014Get Testing with tSQLt - SQL In The City Workshop 2014
Get Testing with tSQLt - SQL In The City Workshop 2014Red Gate Software
 
Kontent.ai DevMeetup #1 - Evoluce prvního veřejného API v hotelovém světě
Kontent.ai DevMeetup #1 - Evoluce prvního veřejného API v hotelovém světěKontent.ai DevMeetup #1 - Evoluce prvního veřejného API v hotelovém světě
Kontent.ai DevMeetup #1 - Evoluce prvního veřejného API v hotelovém světěPeter Sedlařík
 
6232 b 01
6232 b 016232 b 01
6232 b 01stamal
 
Oracle developer Course in Jordan دورة اوراكل في الاردن
Oracle developer Course in Jordan دورة اوراكل في الاردنOracle developer Course in Jordan دورة اوراكل في الاردن
Oracle developer Course in Jordan دورة اوراكل في الاردنayman hamdan
 
My first powershell script
My first powershell scriptMy first powershell script
My first powershell scriptDavid Cobb
 
DMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4ReportingDMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4ReportingDavid Mann
 
Server Check.in case study - Drupal and Node.js
Server Check.in case study - Drupal and Node.jsServer Check.in case study - Drupal and Node.js
Server Check.in case study - Drupal and Node.jsJeff Geerling
 
Sql developer - Powerful Free tool for Developers and DBA's
Sql developer - Powerful Free tool for Developers and DBA'sSql developer - Powerful Free tool for Developers and DBA's
Sql developer - Powerful Free tool for Developers and DBA'sNavneet Upneja
 
Vinod kumar jain resume
Vinod kumar jain   resumeVinod kumar jain   resume
Vinod kumar jain resumeVinod Jain
 
Test Automation for Packaged Systems: Yes, You Can!
Test Automation for Packaged Systems: Yes, You Can!Test Automation for Packaged Systems: Yes, You Can!
Test Automation for Packaged Systems: Yes, You Can!TechWell
 
Store, Extract, Transform, Load, Visualize. Untagged Conference
Store, Extract, Transform, Load, Visualize. Untagged ConferenceStore, Extract, Transform, Load, Visualize. Untagged Conference
Store, Extract, Transform, Load, Visualize. Untagged ConferenceAni Lopez
 
Office Add-ins community call-November 2019
Office Add-ins community call-November 2019Office Add-ins community call-November 2019
Office Add-ins community call-November 2019Microsoft 365 Developer
 
SharePoint 2013 – the upgrade story
SharePoint 2013 – the upgrade storySharePoint 2013 – the upgrade story
SharePoint 2013 – the upgrade storySPC Adriatics
 

Semelhante a AlwaysOn Availability Group Job Management (20)

Rajnish singh(presentation on oracle )
Rajnish singh(presentation on  oracle )Rajnish singh(presentation on  oracle )
Rajnish singh(presentation on oracle )
 
ow.ppt
ow.pptow.ppt
ow.ppt
 
ow.ppt
ow.pptow.ppt
ow.ppt
 
Office Add-ins community call-June 2019
Office Add-ins community call-June 2019Office Add-ins community call-June 2019
Office Add-ins community call-June 2019
 
ETL for the masses with Power Query and M
ETL for the masses with Power Query and METL for the masses with Power Query and M
ETL for the masses with Power Query and M
 
Plantilla oracle
Plantilla oraclePlantilla oracle
Plantilla oracle
 
Get Testing with tSQLt - SQL In The City Workshop 2014
Get Testing with tSQLt - SQL In The City Workshop 2014Get Testing with tSQLt - SQL In The City Workshop 2014
Get Testing with tSQLt - SQL In The City Workshop 2014
 
Kontent.ai DevMeetup #1 - Evoluce prvního veřejného API v hotelovém světě
Kontent.ai DevMeetup #1 - Evoluce prvního veřejného API v hotelovém světěKontent.ai DevMeetup #1 - Evoluce prvního veřejného API v hotelovém světě
Kontent.ai DevMeetup #1 - Evoluce prvního veřejného API v hotelovém světě
 
6232 b 01
6232 b 016232 b 01
6232 b 01
 
Oracle developer Course in Jordan دورة اوراكل في الاردن
Oracle developer Course in Jordan دورة اوراكل في الاردنOracle developer Course in Jordan دورة اوراكل في الاردن
Oracle developer Course in Jordan دورة اوراكل في الاردن
 
My first powershell script
My first powershell scriptMy first powershell script
My first powershell script
 
DMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4ReportingDMann-SQLDeveloper4Reporting
DMann-SQLDeveloper4Reporting
 
Server Check.in case study - Drupal and Node.js
Server Check.in case study - Drupal and Node.jsServer Check.in case study - Drupal and Node.js
Server Check.in case study - Drupal and Node.js
 
Do you queue
Do you queueDo you queue
Do you queue
 
Sql developer - Powerful Free tool for Developers and DBA's
Sql developer - Powerful Free tool for Developers and DBA'sSql developer - Powerful Free tool for Developers and DBA's
Sql developer - Powerful Free tool for Developers and DBA's
 
Vinod kumar jain resume
Vinod kumar jain   resumeVinod kumar jain   resume
Vinod kumar jain resume
 
Test Automation for Packaged Systems: Yes, You Can!
Test Automation for Packaged Systems: Yes, You Can!Test Automation for Packaged Systems: Yes, You Can!
Test Automation for Packaged Systems: Yes, You Can!
 
Store, Extract, Transform, Load, Visualize. Untagged Conference
Store, Extract, Transform, Load, Visualize. Untagged ConferenceStore, Extract, Transform, Load, Visualize. Untagged Conference
Store, Extract, Transform, Load, Visualize. Untagged Conference
 
Office Add-ins community call-November 2019
Office Add-ins community call-November 2019Office Add-ins community call-November 2019
Office Add-ins community call-November 2019
 
SharePoint 2013 – the upgrade story
SharePoint 2013 – the upgrade storySharePoint 2013 – the upgrade story
SharePoint 2013 – the upgrade story
 

Último

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 

Último (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

AlwaysOn Availability Group Job Management

  • 1. Job Management in an AlwaysOn World How to handle jobs that need to run on the primary replica.
  • 2. About Me… • Database Administrator at Boulder County • Twitter: @_KenWilson • Blog: SQLBama.com • LinkedIn: https://www.linkedin.com/in/sqlbama Ken Wilson
  • 3. Agenda • Types of Jobs • Job Failover Options
  • 4.
  • 5. Job Types • Active X • Command Line • PowerShell OS • Command Jobs • Query JobsAnalysis Services • Packages • Maintenance Plans Integration Services • Replication • T-SQL StatementsSQL Server
  • 6. So What Are My Options • Add a job step • Add a job server • Move logic out of SQL Agent • Use Alerts to enable/disable jobs
  • 7.
  • 8. Adding a Job Step • Add top level job step. • Use logic to detect primary • Continue Processing • Exit Gracefully • Possible Issues  Detection could be tricky  In 2012 you need to come up with the logic yourself  In 2014 and newer you can use the system function sys.fn_hadr_is_primary_replica  Misleading Error Log • Active X • Command Line • PowerShell OS • Command Jobs • Query Jobs Analysis Services • Packages • Maintenance Plans Integration Services • Replication • T-SQL StatementsSQL Server
  • 9. Add Job Server • Build a separate SQL Server • Configure Job Server for Multi-Server Administration • Point Jobs at target servers • Possible Issues  Initial Setup  Cost • Active X • Command Line • PowerShell OS • Command Jobs • Query Jobs Analysis Services • Packages • Maintenance Plans Integration Services • Replication • T-SQL StatementsSQL Server
  • 10. Moving Logic • Move primary detection logic out of the SQL Agent Job  Works well with T-SQL Statements and OS job types  Examples: Ola Hallengren’s Maintenance Solution and MidnightDBA’s Minion Backup Solution • Possible Issues  Need access to code  Replication job types may be difficult to setup. • Active X • Command Line • PowerShell OS • Command Jobs • Query Jobs Analysis Services • Packages • Maintenance Plans Integration Services • Replication • T-SQL StatementsSQL Server
  • 11. Using Alerts • Setup Alert on 1480 (AlwaysOn Role Change) • Setup Job to enable/disable other jobs • Use the response of the alert to execute the disable/enable job. • Possible Issues  Initial Setup a little more involved  False positives are possible • Active X • Command Line • PowerShell OS • Command Jobs • Query Jobs Analysis Services • Packages • Maintenance Plans Integration Services • Replication • T-SQL StatementsSQL Server
  • 12.
  • 13. To Recap… • No one right way to manage jobs • Document, Document, Document
  • 14. References • Michael Campbell’s Blog Series  http://sqlmag.com/blog/alwayson-availability-groups-and-sql-server-jobs-part-1- introduction • SQL Agent Job Types  https://msdn.microsoft.com/en-US/librAry/ms187056.aspx • Minion Backup  http://minionware.net/backup/ • Ola Halengren  https://ola.hallengren.com/

Notas do Editor

  1. Hosting T-SQL Tuesday in August so be on the lookout for that.
  2. ActiveX: slated to be removed in future version. OS Commans: require bat, cmd, com or exe extensions Powershell: Either text or script to be executed Analysis Services: Command jobs or Query Jobs Integration Services packages Replication: Snapshot job, Distribution job, Merge job, etc. Replication Executeables T-SQL Statements
  3. Gotchas: Using the function if you misspell the database name or the database doesn’t exist it will not error it will simply return 0
  4. Because replication jobs run the replication executeables
  5. Who has AlwaysOn in their environment? Who has alerts setup to alert them of Data Movement and Role changes? Three alerts you should have: 35264 (Suspended), 35265 (Resumed), 1480 (Role Change) Michael Campbell’s blog about alerts
  6. Michael Campbell’s blog series has much more in-depth information about adding job steps and alerts