Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install-DbaMaintenanceSolution - Add auto-scheduling #8911

Merged
merged 4 commits into from
May 12, 2023

Conversation

potatoqualitee
Copy link
Member

@potatoqualitee potatoqualitee commented May 11, 2023

Adds auto scheduling. By default, when -AutoScheduleJobs WeeklyFull is used and if no other jobs are running at 1:15 AM, this is the schedule it makes:

 Install-DbaMaintenanceSolution -SqlInstance localhost -InstallJobs -AutoScheduleJobs WeeklyFull -ReplaceExisting
Name Description
15 Minute Log Backup Occurs every day every 15 minute(s) between 12:00:00 AM and 11:59:59 PM.
Daily Diff Backup Occurs every week on Monday, Tuesday, Wednesday, Thursday, Friday, Saturday at 1:15 AM.
Weekly Clean and Purge Occurs every week on Sunday at 11:50:00 PM.
Weekly Full User Backup Occurs every week on Sunday at 1:15:00 AM.
Daily Full System Backup Occurs every day at 1:15:00 AM.
Weekly Index Optimization Occurs every week on Saturday at 10:45:00 PM.
Weekly Integrity Check Occurs every week on Saturday at 10:45:00 AM.

I decided to run the Weekly Clean and Purge at the same time bc it's not very impactful.

Index Optimization is 2.5 hours earlier (on Saturday night) than the full backups which will start at 1:15 AM on Sunday morning. Integrity checks start 12 hours earlier than that at 10:45 AM. I'm open to suggestions here.

Diffs run every night except the night that Fulls are made 👍🏼

You can change the start time if you wish then the subtractions will occur from that start time. Oh, and if anything is scheduled at 1:15 AM on Sunday, it'll keep trying for an open slot each hour until it finds it. So the next try will be at 2:15 AM, then 3:15 AM, etc.

I have to merge this by tomorrow, and will need to add tests and documentation but I wanted to do an earlier PR in case anyone wanted to review it.

@andreasjordan
Copy link
Contributor

I'll try to have a look this weekend.

Just some days ago Brent blogged about his configuration: https://www.brentozar.com/archive/2023/05/how-to-configure-ola-hallengrens-database-maintenance-scripts-for-backups/

@potatoqualitee
Copy link
Member Author

Thank you! Ola also added some suggestions to his FAQ

https://ola.hallengren.com/frequently-asked-questions.html

Copy link
Collaborator

@jpomfret jpomfret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this idea! Makes sense to me - only concern for me would be the check db running at Saturday at 10:45:00 AM. I think a lot of businesses this would still be considered as business hours, even though it's a satuday?

@potatoqualitee
Copy link
Member Author

It was challenging to figure out what should go where without overlap. One night is heavy IO with backups, then there's the integrity checks then I didn't want to encroach too much upon Friday bc that's when some people closeout and run stuff so this seemed like a reasonable compromise that would allow their week-end stuff to run. But overall, this is just an approximation for the general weekday crowd and weekenders can modify as needed.

@potatoqualitee
Copy link
Member Author

i have to publish dbatools so this branch will be 2.0.2

@potatoqualitee potatoqualitee merged commit 63cb56b into development May 12, 2023
@potatoqualitee potatoqualitee deleted the autoschedule branch May 12, 2023 09:19
@frodr1k
Copy link

frodr1k commented May 26, 2023

I seem to cant find information about autoscheduling in the documentation yet.

/Fredrik

@potatoqualitee
Copy link
Member Author

thank you! looking into it now

@potatoqualitee
Copy link
Member Author

there we go, thanks for the ping! https://docs.dbatools.io/Install-DbaMaintenanceSolution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants