Transact-SQL scripts and gists for administration and diagnostics.
You'll also find some management stored procedures
Feel free to use them and copy them. If you have significant improvements to propose, please fork the repo and propose a pull request.
You'll find here the following folders :
- azure-sql-database — queries for Azure SQL Database administration and diagonstics. Those queries use specific Azure SQL Database views and metadata. Some Extended events for Azure can also be found in extended-events/azure-sql-database.
- database-administration — queries for database maintenance, DDL generation, informations about security principals and privileges, SQL Server Agent, alerts and code to create the
_dba
database I use for some customers. - database-information — metadata about databases : size, compression, transaction log, etc.
- diagnostics — diagnostics queries.
- execution — diagnostics queries to inspect running queries, procedures and active transactions.
- execution-stats — statistics about query performances.
- IO — information about physical IO.
- locking — locking and blocking.
- memory — memory usage : buffer pool and plan cache.
- query-store — Query Store management.
- sessions — opened sessions.
- tempdb — tempdb diagnostics queries, including version store.
- wait_statistics — Wait statistics.
- extended-events — code to create extended events on-prem and on Azure SQL Database. You'll also find queries to read the content of the targets.
- hadr — queries for AlwaysOn Failover Clustering and AlwaysOn Availability Groups.
- index-management — missing indexes, index usage, fragmentation analysis, etc.
- monitoring — queries to monitor current operations, like backups, shrink or DBCC execution.
- powershell — Powershell scripts for administration.
- replication — Replication related queries.
- server-information — queries to get server / instance information.
- service-broker — Service Broker related queries
- stored-procedures — Stored procedure for quick info in your database, like getting active transactions, database information, memory status or sp_logspace, a replacement for
DBCC SQLPERF (LOGSPACE)
.