Skip to content
SQL Jupyter Notebook PowerShell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
AG - Am I Primary.sql
AG - Health_XEvents.sql
AG - Monitor.sql
AG - PerfMon counters.sql
AG - alerts.sql
AG - check owner.sql
AG - extendedEvents_Create.sql
AG - failover (in development).ps1
AG - monitor automatic seeding.sql
AG - post-zerto failover.ps1
AG - readonly routing urls.sql
AG - worker threads diagnostic.sql
Job - File Growth Management.sql
SSRS rebuild RSExecRole permissions.sql
add database descriptions.sql
add error event alerts.sql
agent job history.sql
audit setup.sql
autogrow change all 1mb growth files.sql
autogrow events.sql
automated index rebuild old.sql
automated index rebuild.sql
avg disk secwrite.png
azure 15min dtu usage.sql
azure 15sec dtu usage.sql
azure sql db scale.ps1
backup history oldest latest.sql
backup history.sql
backup progress.sql
backup readonly copy restore.sql
backup restore progress.sql
backup to azure blob tsql script for legacy SQL.sql
bad clustered indexes.sql
basic diff backup to URL.sql
basic full backup to URL system dbs.sql
basic full backup to URL.sql
basic log backup to URL.sql
capture login info xevent 2008.sql
capture login info xevent.sql
checksum vs hashbytes.sql
collect connections.sql
compress indexes.sql
configuration changes history.sql
cpu utilization.sql
database mail diag.sql
database mail profiles.sql
database ownership.sql
database settings info.sql
deadlocks in xevents.sql
defrag columnstore.sql
deprecated usage counter.sql
easy passwords.sql
endpoint owners.sql
error log.sql
failover cluster force quorum.ps1
filtered index opportunities.sql
find duplicate indexes.sql
find memory mini dumps.sql
firstByte (working).sql
fix orphaned sid.sql
fk untrusted or disabled check.sql
fulltext index demo.sql
fulltext index status.sql
gather log events - remoting.ps1
gather log events.ps1
generate error tables.sql
get disk block allocation size.ps1
guest permissions.sql
hypothetical cleanup.sql
indirect checkpoints enable.sql
install failover clustering features.ps1
job - Backup Failure Notifications.sql
job - Space in Files Monitoring.sql
job - Volume Stats Monitoring for Production.sql
job - Volume Stats Monitoring.sql
job - job failure notifications.sql
job - memory stats Monitoring.sql
job - setup database audit.sql
job - startup failures.sql
job failure notifications.sql
job owners.sql
job status.sql
kill detect blocking sessions setup.sql
kill detect blocking spids job.sql
kill detect blocking spids.sql
lab - FORMATMESSAGE in SQL2016.sql
lab - TSQL 101.sql
lab - TemporalTable demo.sql
lab - VLF generation example.sql
lab - azure blob storage retention plan.ps1
lab - backup to URL.sql
lab - basic error table.sql
lab - clustered key design.sql
lab - concat_ws.sql
lab - datetime conversion from datetime to datetimeoffsets.sql
lab - deadlock part 1.sql
lab - deadlock part 2.sql
lab - docker win AG.ps1
lab - docker.ps1
lab - dynamic data masking.sql
lab - execute as.sql
lab - filetable demo.sql
lab - fk untrusted or disabled check.ipynb
lab - fk untrusted or disabled check.sql
lab - float as pk problems.sql
lab - fragmented table int.sql
lab - fragmented table newsequentialid.sql
lab - fragmented table.sql
lab - implicit conversion.sql
lab - materialized view with columnstore.sql
lab - memory optimized table.sql
lab - missing index setup demo.sql
lab - nonsequentialguid.sql
lab - optimize_for_sequential_key testing.sql
lab - partitioning 101.sql
lab - power of columnstore.sql
lab - pre2016 correct time zone conversion from UTC.sql
lab - replaceFloatWithDecimal.sql
lab - resumeable index maintenance.sql
lab - security p1.sql
lab - security p2.sql
lab - sequence permissions.sql
lab - sql agent execution lab.sql
lab - string truncation error message improvement in SQL 2019.sql
lab - tde encryption workshop 2014.sql
lab - testing mem opt.sql
lab - time zone.sql
lab - translate syntax.sql
last known DBCC CHECKDB.sql
limit number of error log files.sql
lock Pages in Memory LPIM.sql
memory-optimized table memory usage.sql
missing indexes.sql
modules vs routines.sql
move system databases.sql
multiserver backup history.sql
multiserver space in files.sql
oledb providers.sql
open transactions.sql
optimize for ad hoc workloads.sql
overdue jobs.sql
page life expectancy Azure SQL DB.sql
page life expectancy.sql
permissions for readonly admin accounts.sql
public permissions.sql
refresh view metadata.sql
rename SQL instance.sql
reports catalog metadata.sql
sas credential.sql
script ssisdb env.sql
security Script databases.sql
security Script servers.sql
security check msdb role members.sql
security check sysadmin members.sql
security group members.sql
services dmv.sql
sessions and requests - Azure SQL DB.sql
sessions and requests - SQL2000.sql
sessions and requests - dump to table.sql
sessions and requests - old temp table.sql
sessions and requests blocking chain.jpg
sessions and requests.sql
sharepoint databases.ps1
sharepoint db recovery models.sql
size database files.sql
size in memory.sql
space in files.sql
sproc sessions and requests.sql
ssis events.sql
ssisdb execution query.sql
ssisdb history cleanup.sql
ssisdb package history.sql
ssrs Subscription catalog inventory.sql
ssrs Subscription failure emails.sql
ssrs Subscription start jobs.sql
ssrs subscription failure logs.sql
ssrs subscriptions status.sql
stats out of date whileloop.sql
stats out of date.sql
tables without clustered indexes.sql
tde status.sql
tempdb data files.sql
tempdb space used diagnostic.sql
test user permissions.sql
uncommitted transactions.sql
vlfs analysis.sql
volume stats.sql
worst query plans.sql
xevent ringbuffer.sql
zip toolbox.ps1


SQL Server Toolbox

Getting Started

A loose assembly of files use for day-to-day administration, performance tuning, troubleshooting and investigation of Microsoft SQL Server databases.


Many scripts have alternative versions for backwards compatibility with SQL Servers prior to SQL Server 2012, most scripts developed for SQL Server 2012 or higher, many with comments indicating features added in specific versions of SQL Server.

Execution intended with SSMS/VSCode without SQLCMD mode enabled for most scripts, unless otherwise noted.

PowerShell should be supported for PowerShell 3+ unless otherwise noted.


Suggestions/corrections welcome. Collaboration limited to Sparkhound SQL DBA team.



  • Code snippet source documented with URL where appropriate, if lacking, please notify us.

Easy Download

You can’t perform that action at this time.