Category: Maintenance
-
DBA Scripts: Enable or Disable All SQL Agent Jobs
Turning every SQL Agent job off is easy. Turning the right ones back on is where it goes wrong. Save the state first, disable with sp_update_job, restore from what you saved, and know why disabling does not stop a running job.
Written by
-
DBA Scripts: Generate Database Integrity and Housekeeping Jobs
🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Maintenance & Automation › Maintenance Job Framework A Readable Generator for Integrity Checks and msdb Housekeeping No DBCC CHECKDB has run in weeks, msdb keeps growing, or the error log is one enormous file: this generator writes the three SQL Agent jobs that…
Written by
-
DBA Scripts: Generate Backup Jobs
🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Maintenance & Automation › Maintenance Job Framework A Readable Generator for Full Backups, Log Backups, and Cleanup If you’re already running Ola Hallengren’s maintenance solution, this won’t replace it, but the approach here might still be useful: a small, readable T-SQL generator that…
Written by
-
DBA Scripts: Run a Full SQL Server Health Check
🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Maintenance & Automation › Collectors & Baselines Is This SQL Server Okay? Collect, Review, Then Find the Root Cause Inherited a server, or sure something is wrong but not what? One command runs 45 read-only checks against the instance. A second turns the…
Written by
-
DBA Scripts: Get Job Schedules and Duration Trends
🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Maintenance & Automation › SQL Agent & Jobs When Jobs Run, and Whether They’re Taking Longer to Do It SQL Agent Job Failure Summary tells you what broke. These two scripts answer two quieter but just as important questions: Get-JobScheduleSummary shows exactly when…
Written by
-
How to Shrink SQL Server Database Files in Chunks
🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Storage & Capacity A data file that’s grown far past what the database actually needs, after a one-off bulk load, an archive cleanup, a migration that left behind a much bigger footprint than the data now occupies, eventually needs to come back down.…
Written by
-
DBA Scripts: Get Index Fragmentation
🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Maintenance & Automation › Index Maintenance Index fragmentation is one of those topics where the received wisdom, “rebuild your indexes every weekend”, causes almost as many problems as it solves. Rebuilding an index that doesn’t need it wastes a maintenance window, takes a…
Written by
-
DBA Scripts: Collect AG Health, Index Fragmentation, Query Store and Error Log Baselines
🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Maintenance & Automation › Collectors & Baselines History for AG Health, Indexes, Query Store and the Error Log When something breaks, the first question is what it looked like before: was the AG secondary already behind last night, when did that query start…
Written by
-
DBA Scripts: Collect TempDB Space, VLF Count and Database Growth Baselines
🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Maintenance & Automation › Collectors & Baselines History for TempDB Space, VLF Counts and Database Growth TempDB filled overnight, or a database grew and nobody knows when: questions only history can answer. The DMVs show how full TempDB is and how big each…
Written by
-
DBA Scripts: Collect Performance Baselines (Wait Stats, Perfmon, Storage I/O)
🔧Part of the DBA-Tools Project, copy/paste SQL Server scripts and health checks.In: Maintenance & Automation › Collectors & Baselines History for Wait Stats, Perfmon Counters and Storage I/O Something was slow between two and three this afternoon, and you want to know what the server was waiting on and whether the disks were struggling. sys.dm_os_wait_stats…
Written by
- Backups & Recovery (18)
- DBA Scripts (154)
- High Availability (HA) (13)
- Installation & Configuration (59)
- Maintenance (25)
- Migration & Upgrades (14)
- Monitoring (9)
- Performance Tuning (37)
- Security (Encryption & Permissions) (25)
- Storage & Capacity (17)
- T-SQL Fundamentals (16)
- Troubleshooting (105)
- Wait Types (236)