Skip to content
Branch: master
Clone or download
Latest commit 32a4c56 Apr 20, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitattributes sql lang detection Sep 24, 2018
AG - Am I Primary.sql cleanup and standardize naming for AG scripts Sep 10, 2018
AG - Health_XEvents.sql updated for correct time zoning, workaround for MS bug in Xevent time… Nov 30, 2018
AG - Monitor.sql add error description field Feb 22, 2019
AG - PerfMon counters.sql
AG - alerts.sql cleanup and standardize naming for AG scripts Sep 10, 2018
AG - check owner.sql cleanup and standardize naming for AG scripts Sep 10, 2018
AG - extendedEvents_Create.sql cleanup and standardize naming for AG scripts Sep 10, 2018
AG - failover (in development).ps1 cleanup and standardize naming for AG scripts Sep 10, 2018
AG - monitor automatic seeding.sql initial add Oct 11, 2018
AG - post-zerto failover.ps1 initial checkin, work in progress still Sep 10, 2018
AG - readonly routing urls.sql cleanup and standardize naming for AG scripts Sep 10, 2018
README.md Update README.md Jan 3, 2019
add database descriptions.sql initial Jul 20, 2017
add error event alerts.sql fix typo Oct 5, 2017
audit setup.sql updated for better naming conventions Aug 10, 2018
autogrow change all 1mb growth files.sql minor tweak Jun 14, 2018
autogrow events.sql update date filter Oct 27, 2017
automated index rebuild old.sql Rename automated index rebuild 2012.sql to automated index rebuild ol… Sep 13, 2018
automated index rebuild.sql typo Apr 17, 2019
avg disk secwrite.png initial Jul 20, 2017
azure 15min dtu usage.sql
azure 15sec dtu usage.sql formatting Feb 1, 2019
azure sql db scale.ps1
backup history oldest latest.sql
backup history.sql add database creation date to the query resultset Jul 30, 2018
backup progress.sql
backup readonly copy restore.sql add norecovery for future utility Jun 19, 2018
backup restore progress.sql initial Jul 20, 2017
backup to azure blob tsql script for legacy SQL.sql prep for generic use Jul 30, 2018
bad clustered indexes.sql clustered index utility scripts Feb 1, 2019
basic diff backup to URL.sql lab for basic backups to URL using SAS credential Apr 17, 2019
basic full backup to URL system dbs.sql lab for basic backups to URL using SAS credential Apr 17, 2019
basic full backup to URL.sql lab for basic backups to URL using SAS credential Apr 17, 2019
basic log backup to URL.sql lab for basic backups to URL using SAS credential Apr 17, 2019
busy databases.sql
capture login info xevent 2008.sql
capture login info xevent.sql rename for asciisort presentation Feb 26, 2019
checksum vs hashbytes.sql initial Jul 20, 2017
collect connections.sql initial Jul 20, 2017
compress indexes.sql initial Jul 20, 2017
configuration changes history.sql initial Jul 20, 2017
cpu utilization.sql redirect to a more sophisticated view of the same cpu data Sep 5, 2018
database mail diag.sql
database mail profiles.sql Revert "Revert "Merge branch 'master' into 20190313dbmail"" Mar 13, 2019
database ownership.sql fix potential typo- wrap db name in brackets Jun 5, 2018
database settings info.sql better comments Dec 14, 2018
deadlocks in xevents.sql case sensitivity Mar 27, 2019
defrag columnstore.sql update comments, add size Oct 11, 2018
defrag.sql latest comments, removed filters by default Nov 29, 2018
dependencies.sql
deprecated usage counter.sql initial Jul 20, 2017
dimdate.sql
dm_exec_query_memory_grants.sql initial Jul 20, 2017
dm_exec_session_wait_stats.sql initial Jul 20, 2017
dm_os_performance_counters.sql
dm_os_wait_stats.sql add qs wait types to ignore Feb 22, 2019
dm_os_waiting_tasks.sql add qs wait types to ignore Feb 22, 2019
easy passwords.sql
endpoint owners.sql initial Jul 20, 2017
error log.sql
failover cluster force quorum.ps1
filtered index opportunities.sql Update filtered index opportunities.sql Feb 1, 2019
find duplicate indexes.sql added space saved, formatting changes Dec 14, 2017
find memory mini dumps.sql rename for proper git sorting Nov 10, 2017
firstByte (working).sql rename for proper git sorting Nov 10, 2017
fix orphaned sid.sql initial Jul 20, 2017
fulltext index demo.sql
fulltext index status.sql add sp_MSforeachdb to scan db's, change join order to find unused cat… Feb 1, 2019
gather log events.ps1 reduce noise Sep 13, 2018
generate error tables.sql
get disk block allocation size.ps1 initial Jul 20, 2017
guest permissions.sql initial Jul 20, 2017
hypothetical cleanup.sql add hypothetical object cleanup script Sep 27, 2018
index ALLOW_PAGE_LOCKS.sql rename for proper git sorting Nov 10, 2017
index_usage_stats.sql improved comments, partition handling, filtering Mar 27, 2019
indirect checkpoints enable.sql initial checkin Nov 20, 2017
install failover clustering features.ps1 initial Sep 11, 2017
instant_file_initialization.sql
job - Backup Failure Notifications.sql Add files via upload Apr 19, 2019
job - Space in Files Monitoring.sql name changes to db, job name Apr 17, 2019
job - Volume Stats Monitoring for Production.sql Update job - Volume Stats Monitoring for Production.sql Apr 19, 2019
job - Volume Stats Monitoring.sql name changes to db, job name Apr 17, 2019
job - job failure notifications.sql standardize these scripts to be more like job owners, db owners, etc Nov 28, 2018
job - memory stats Monitoring.sql
job - setup database audit.sql setup database audit job script Aug 10, 2018
job - startup failures.sql latest prototype in place in the field Mar 27, 2019
job failure notifications.sql
job owners.sql
job status.sql initial Oct 16, 2017
kill detect blocking sessions setup.sql initial Jul 20, 2017
kill detect blocking spids job.sql Update kill detect blocking spids job.sql Feb 26, 2019
kill detect blocking spids.sql
lab - FORMATMESSAGE in SQL2016.sql rename/organize Nov 9, 2017
lab - TSQL 101.sql
lab - TemporalTable demo.sql rename/organize Nov 9, 2017
lab - VLF generation example.sql
lab - azure blob storage retention plan.ps1 add lab for powershell retention Feb 2, 2018
lab - backup to URL.sql
lab - basic error table.sql demonstrate issue with THROW only returning second (useless) error. Jul 30, 2018
lab - clustered key design.sql new file Feb 19, 2018
lab - concat_ws.sql update for lab demo Feb 15, 2018
lab - deadlock part 1.sql rename/organize Nov 9, 2017
lab - deadlock part 2.sql rename/organize Nov 9, 2017
lab - dynamic data masking.sql rename/organize Nov 9, 2017
lab - filetable demo.sql
lab - fragmented table int.sql update for dmv preso Sep 5, 2018
lab - fragmented table newsequentialid.sql update for dmv preso Sep 5, 2018
lab - fragmented table.sql
lab - implicit conversion.sql initial checkin Feb 20, 2018
lab - materialized view with columnstore.sql Update lab - materialized view with columnstore.sql Oct 15, 2018
lab - missing index setup demo.sql rename/organize Nov 9, 2017
lab - partitioning 101.sql Create lab - partitioning 101.sql Mar 27, 2019
lab - power of columnstore.sql
lab - pre2016 correct time zone conversion from UTC.sql index addition to DSTDates table for pre2016 use Jan 8, 2018
lab - replaceFloatWithDecimal.sql rename for proper git sorting Nov 10, 2017
lab - sql agent execution lab.sql
lab - tde encryption workshop 2014.sql
lab - testing mem opt.sql cleanup Nov 28, 2018
lab - time zone.sql rename/organize Nov 9, 2017
lab - translate syntax.sql initial checkin for 2017 demo syntax scripts Feb 14, 2018
lock Pages in Memory LPIM.sql rename for proper git sorting Nov 10, 2017
log_reuse_wait.sql
memory-optimized table memory usage.sql initial Feb 14, 2018
missing indexes.sql updates for all-dbs version, filtering, lab mention Sep 12, 2018
modules vs routines.sql
move system databases.sql
multiserver backup history.sql
multiserver space in files.sql initial Jul 20, 2017
my_permissions.sql split up sec files Apr 4, 2019
oledb providers.sql initial checkin of this script Jun 1, 2018
open transactions.sql
optimize for ad hoc workloads.sql
overdue jobs.sql
page life expectancy Azure SQL DB.sql add Azure SQL DB version Feb 1, 2019
page life expectancy.sql update comments for versions supported Oct 15, 2018
public permissions.sql Update public permissions.sql Mar 6, 2018
rebuild SSRS RSExecRole permissions.sql sync Aug 30, 2017
record_dm_io_virtual_file_stats.sql initial Jul 20, 2017
refresh view metadata.sql
rename SQL instance.sql rename for proper git sorting Nov 10, 2017
reports catalog metadata.sql
restore.sql rename/organize Nov 9, 2017
sas credential.sql
script ssisdb env.sql Update script ssisdb env.sql Mar 27, 2019
security Script databases.sql
security Script servers.sql Update security Script servers.sql Mar 13, 2019
security Script_powershell.ps1
security group members.sql
services dmv.sql sync Aug 30, 2017
sessions and requests Azure SQL DB.sql split out new version for Azure SQL DB Jan 25, 2019
sessions and requests blocking chain.jpg
sessions and requests cte.sql
sessions and requests table.sql column renames, data types, better time column names, pct complete Mar 4, 2019
sessions and requests.sql column renames, data types, better time column names, pct complete Mar 4, 2019
sessions sql2000.sql
sharepoint databases.ps1 initial checkin Dec 21, 2017
sharepoint db recovery models.sql rename for asciisort presentation Feb 26, 2019
size database files.sql
size in memory.sql initial Jul 20, 2017
size.sql
sp_GetAGInformation.sql
sp_repldone.sql
space in files.sql
sproc sessions and requests.sql initial Jul 20, 2017
ssis events.sql initial Jul 20, 2017
ssisdb execution query.sql initial Jul 20, 2017
ssisdb package history.sql add ssis package version history Aug 2, 2018
ssrs Subscription catalog inventory.sql rename for proper git sorting Nov 10, 2017
ssrs Subscription failure emails.sql make generic Jul 30, 2018
ssrs Subscription start jobs.sql rename for proper git sorting Nov 10, 2017
ssrs subscriptions status.sql
stats out of date whileloop.sql better comments Feb 1, 2019
stats out of date.sql
sys.dm_io_virtual_file_stats.sql initial Jul 20, 2017
sys_dm_os_ring_buffers.sql new diagnostic sample script Oct 9, 2017
tables without clustered indexes.sql
tde status.sql
tempdb data files.sql add vol info to tempdb query Jan 3, 2019
test user permissions.sql
toolbox-stablestate.zip latest autozip Apr 4, 2019
toolbox.zip latest files Apr 19, 2019
uncommitted transactions.sql initial add Jul 9, 2018
vlfs analysis.sql Update vlfs analysis.sql Apr 3, 2019
volume stats.sql Added Volume Name Nov 20, 2018
worker threads diagnostic.sql update comments Dec 17, 2018
worst query plans.sql
xevent ringbuffer.sql
zip toolbox.ps1 improved comments Mar 27, 2019

README.md

sql-server-toolbox

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.

Prerequisites

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.

Contributing

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

Contributors

Acknowledgments

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

Easy Download

You can’t perform that action at this time.