# olahallengren/sql-server-maintenance-solution

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/olahallengren-sql-server-maintenance-solution).**

3,295 stars · 850 forks · TSQL · mit

## Links

- GitHub: https://github.com/olahallengren/sql-server-maintenance-solution
- Homepage: https://ola.hallengren.com
- awesome-repositories: https://awesome-repositories.com/repository/olahallengren-sql-server-maintenance-solution.md

## Topics

`sqlserver`

## Description

This project is a T-SQL maintenance framework and suite of automated scripts for SQL Server. It functions as a backup automator, index optimizer, and integrity checker designed to manage routine database administration tasks through a programmable set of stored procedures.

The solution distinguishes itself through a focus on automated orchestration, including the ability to target or exclude databases within Availability Groups and the use of mirror-write backup streams for redundancy. It employs fragmentation-driven indexing to determine whether to rebuild or reorganize indexes based on user-defined thresholds and utilizes token-based file pathing for dynamic backup naming.

The framework covers broad capability areas including backup management with retention policy enforcement, data integrity monitoring through consistency checks, and performance optimization via statistics updates. It also provides maintenance auditing through centralized relational logging and supports backup encryption using server certificates.

The system is implemented using T-SQL-based procedural logic and a table-based configuration store to execute operations directly within the database engine.

## Tags

### Data & Databases

- [Scheduled Database Backups](https://awesome-repositories.com/f/data-databases/automated-backup-systems/scheduled-database-backups.md) — Performs automated full, differential, and transaction log backups to local or cloud storage. ([source](https://cdn.jsdelivr.net/gh/olahallengren/sql-server-maintenance-solution@main/README.md))
- [Automated Backup Systems](https://awesome-repositories.com/f/data-databases/automated-backup-systems.md) — Provides a comprehensive system for scheduling and managing periodic database backups.
- [Automated Backup Integrity Checks](https://awesome-repositories.com/f/data-databases/backup-and-recovery/backup-and-restore-monitoring/automated-backup-integrity-checks.md) — Runs verification checks on produced backups to ensure data is readable and consistent. ([source](https://ola.hallengren.com/sql-server-backup.html))
- [Database Consistency Checks](https://awesome-repositories.com/f/data-databases/database-consistency-checks.md) — Runs database consistency checks to ensure data health across various levels of the database hierarchy. ([source](https://ola.hallengren.com))
- [Database Indexing Tools](https://awesome-repositories.com/f/data-databases/database-indexing-tools.md) — Optimizes query performance by automatically rebuilding or reorganizing fragmented indexes and updating statistics.
- [Database Integrity Checks](https://awesome-repositories.com/f/data-databases/database-integrity-checks.md) — Performs automated consistency checks and verifies backup readability to detect physical or logical data corruption.
- [Maintenance Target Filtering](https://awesome-repositories.com/f/data-databases/database-object-filters/maintenance-target-filtering.md) — Provides logic to target specific databases or exclude those in Availability Groups during maintenance.
- [Relational Configuration Stores](https://awesome-repositories.com/f/data-databases/relational-configuration-stores.md) — Stores job settings and retention policies in dedicated tables for dynamic runtime parameterization.
- [Stored Procedures](https://awesome-repositories.com/f/data-databases/stored-procedures.md) — Executes maintenance operations using stored procedures directly within the database engine.
- [T-SQL Maintenance Frameworks](https://awesome-repositories.com/f/data-databases/t-sql-maintenance-frameworks.md) — Implements a programmable framework of stored procedures and jobs for auditing and executing parallel database administration tasks.
- [Index Maintenance](https://awesome-repositories.com/f/data-databases/table-data-retrieval/index-optimizations/index-maintenance.md) — Implements fragmentation-driven routines to rebuild or reorganize indexes and update statistics for improved query performance.
- [Multi-Destination Backup Storage](https://awesome-repositories.com/f/data-databases/backup-storage-backends/multi-destination-backup-storage.md) — Routes backups to multiple destinations including local disks, network paths, and cloud storage. ([source](https://ola.hallengren.com/versions.html))
- [Mirrored Backup Streams](https://awesome-repositories.com/f/data-databases/data-engineering-infrastructure/data-persistence-storage/data-storage/file-based-storage/local-file-storage/local-file-writing/binary-file-writing/streamed-writes/mirrored-backup-streams.md) — Simultaneously writes backup data to primary and secondary directories for redundancy.
- [Statistics Updates](https://awesome-repositories.com/f/data-databases/query-performance-monitors/query-statistics-repositories/statistics-collectors/statistics-updates.md) — Refreshes index and column statistics for specific objects to ensure the query optimizer chooses efficient execution paths. ([source](https://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html))

### Development Tools & Productivity

- [Index Maintenance](https://awesome-repositories.com/f/development-tools-productivity/search-indexing-tools/local-file-indexers/on-demand-indexers/index-maintenance.md) — Rebuilds or reorganizes indexes based on fragmentation levels using online or offline operations to ensure retrieval efficiency. ([source](https://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html))
- [Parallel Task Execution](https://awesome-repositories.com/f/development-tools-productivity/parallel-task-execution.md) — Executes maintenance tasks across multiple databases simultaneously by distributing workloads across available CPU resources. ([source](https://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html))
- [Token-Based Path Resolution](https://awesome-repositories.com/f/development-tools-productivity/web-based-file-managers/web-based-file-managers/file-path-mapping/dynamic-path-expressions/token-based-path-resolution.md) — Generates dynamic backup filenames and directory structures using server and database metadata tokens.

### Programming Languages & Runtimes

- [Fragmentation-Based Index Optimization](https://awesome-repositories.com/f/programming-languages-runtimes/fragment-integration/fragmentation-based-index-optimization.md) — Determines whether to rebuild or reorganize indexes by analyzing fragmentation levels against user-defined thresholds.

### System Administration & Monitoring

- [Automated Server Maintenance](https://awesome-repositories.com/f/system-administration-monitoring/automated-server-maintenance.md) — Provides a comprehensive suite of automated scripts for managing backups, integrity checks, and index optimization in SQL Server.
- [Availability Group Orchestration](https://awesome-repositories.com/f/system-administration-monitoring/availability-group-orchestration.md) — Targets maintenance and backup operations to specific availability groups or excludes databases belonging to them. ([source](https://ola.hallengren.com/scripts/MaintenanceSolution.sql))
- [SQL Server Availability Group Administration](https://awesome-repositories.com/f/system-administration-monitoring/sql-server-availability-group-administration.md) — Coordinates maintenance and backup tasks specifically for databases within or excluded from Always On availability groups.
- [SQL Server Integrity Monitoring](https://awesome-repositories.com/f/system-administration-monitoring/sql-server-integrity-monitoring.md) — Runs automated consistency checks to detect physical or logical corruption across databases, filegroups, and tables.
- [Maintenance Activity Logging](https://awesome-repositories.com/f/system-administration-monitoring/automated-server-maintenance/maintenance-activity-logging.md) — Provides centralized relational logging to track the start, end, and outcome of maintenance tasks for troubleshooting and compliance.
- [Policy-Based Retention](https://awesome-repositories.com/f/system-administration-monitoring/backup-utilities/policy-based-retention.md) — Deletes old backup files based on expiration dates or retention periods to reclaim storage. ([source](https://ola.hallengren.com/versions.html))
- [Execution Audit Trails](https://awesome-repositories.com/f/system-administration-monitoring/execution-audit-trails.md) — Provides structured logging and audit trails for the execution of database maintenance tasks.
- [Parallel Maintenance Task Distribution](https://awesome-repositories.com/f/system-administration-monitoring/parallel-maintenance-task-distribution.md) — Implements parallel distribution of maintenance tasks across available CPU resources to accelerate execution.
- [Server Activity Logs](https://awesome-repositories.com/f/system-administration-monitoring/server-activity-logs.md) — Records the start, end, and outcome of maintenance tasks to a central table for auditing and troubleshooting. ([source](https://cdn.jsdelivr.net/gh/olahallengren/sql-server-maintenance-solution@main/README.md))

### DevOps & Infrastructure

- [Backup Set Mirroring](https://awesome-repositories.com/f/devops-infrastructure/file-uploaders/multi-destination-uploads/backup-set-mirroring.md) — Writes backups to a primary directory and one or more mirror directories simultaneously. ([source](https://ola.hallengren.com/sql-server-backup.html))

### Operating Systems & Systems Programming

- [Dynamic File Name Resolvers](https://awesome-repositories.com/f/operating-systems-systems-programming/system-administration-maintenance/file-system-management/file-systems/file-template-generators/dynamic-file-name-resolvers.md) — Resolves placeholders in filenames to generate dynamic directory structures and backup names. ([source](https://ola.hallengren.com/sql-server-backup.html))
