Skip to content
Branch: master
Clone or download
Latest commit 011b9c8 May 3, 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
AG - Health_XEvents.sql updated for correct time zoning, workaround for MS bug in Xevent time… Nov 30, 2018
AG - Monitor.sql add collation Apr 23, 2019
AG - PerfMon counters.sql cleanup and standardize naming for AG scripts Sep 10, 2018
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
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
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 comment name fix Apr 23, 2019
avg disk secwrite.png initial Jul 20, 2017
azure 15min dtu usage.sql formatting Feb 1, 2019
azure 15sec dtu usage.sql formatting Feb 1, 2019
azure sql db scale.ps1 initial add Aug 23, 2018
backup history oldest latest.sql Update backup history oldest latest.sql Feb 2, 2018
backup history.sql add database creation date to the query resultset Jul 30, 2018
backup progress.sql shows backup progress Mar 31, 2019
backup readonly copy restore.sql
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 encoding change Sep 10, 2018
capture login info xevent 2008.sql rename for asciisort presentation Feb 26, 2019
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
database mail diag.sql maybe i'm not great at merging Mar 13, 2019
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 reorganization, comments May 2, 2019
defrag columnstore.sql update comments, add size Oct 11, 2018
defrag.sql latest comments, removed filters by default Nov 29, 2018
dependencies.sql initial Jul 20, 2017
deprecated usage counter.sql initial Jul 20, 2017
dimdate.sql sync Aug 30, 2017
dm_exec_query_memory_grants.sql initial Jul 20, 2017
dm_exec_session_wait_stats.sql
dm_os_performance_counters.sql add Sep 5, 2018
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 performance improvements, more comments and TODO's Oct 24, 2018
endpoint owners.sql initial Jul 20, 2017
error log.sql add keywords Mar 4, 2019
failover cluster force quorum.ps1 add Aug 23, 2018
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 initial add for dev resources Jan 25, 2019
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
generate error tables.sql initial Jul 20, 2017
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 Update index_usage_stats.sql May 1, 2019
indirect checkpoints enable.sql
install failover clustering features.ps1 initial Sep 11, 2017
instant_file_initialization.sql update comments for versions supported Oct 15, 2018
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 typo Apr 25, 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 better filter and sample data Sep 10, 2018
job status.sql initial Oct 16, 2017
kill detect blocking sessions setup.sql
kill detect blocking spids job.sql Update kill detect blocking spids job.sql Feb 26, 2019
kill detect blocking spids.sql initial Jul 20, 2017
lab - FORMATMESSAGE in SQL2016.sql
lab - TSQL 101.sql initial checkin, file for a SQL 101 talk at Activate Conference Feb 21, 2018
lab - TemporalTable demo.sql rename/organize Nov 9, 2017
lab - VLF generation example.sql rename/organize Nov 9, 2017
lab - azure blob storage retention plan.ps1 add lab for powershell retention Feb 2, 2018
lab - backup to URL.sql rename/organize Nov 9, 2017
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 rename/organize Nov 9, 2017
lab - fragmented table int.sql update for dmv preso Sep 5, 2018
lab - fragmented table newsequentialid.sql
lab - fragmented table.sql update for case sensitive db's, latest comments Mar 7, 2019
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 rename/organize Nov 9, 2017
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 rename/organize Nov 9, 2017
lab - tde encryption workshop 2014.sql additional lab steps, add tde status as separate file Apr 4, 2019
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 initial add Jul 9, 2018
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 initial Jul 20, 2017
multiserver backup history.sql initial Jul 20, 2017
multiserver space in files.sql
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 initial Jul 20, 2017
overdue jobs.sql comments only Sep 10, 2018
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
record_dm_io_virtual_file_stats.sql initial Jul 20, 2017
refresh view metadata.sql initial Jul 20, 2017
rename SQL instance.sql rename for proper git sorting Nov 10, 2017
reports catalog metadata.sql initial Jul 20, 2017
restore.sql rename/organize Nov 9, 2017
sas credential.sql lab for basic backups to URL using SAS credential Apr 17, 2019
script ssisdb env.sql Update script ssisdb env.sql Mar 27, 2019
security Script databases.sql rename for proper git sorting Nov 10, 2017
security Script servers.sql Update security Script servers.sql Mar 13, 2019
security Script_powershell.ps1 Update security Script_powershell.ps1 Mar 8, 2019
security group members.sql
services dmv.sql sync Aug 30, 2017
sessions and requests - Azure SQL DB.sql upgraded of sessions and requests, rename other related files Apr 25, 2019
sessions and requests - dump to table.sql upgraded of sessions and requests, rename other related files Apr 25, 2019
sessions and requests - old temp table.sql upgraded of sessions and requests, rename other related files Apr 25, 2019
sessions and requests blocking chain.jpg initial Jul 20, 2017
sessions and requests.sql upgraded of sessions and requests, rename other related files Apr 25, 2019
sessions sql2000.sql initial Jul 20, 2017
sharepoint databases.ps1 initial checkin Dec 21, 2017
sharepoint db recovery models.sql rename for asciisort presentation Feb 26, 2019
size database files.sql rename for proper git sorting Nov 10, 2017
size in memory.sql initial Jul 20, 2017
size.sql initial Jul 20, 2017
sp_GetAGInformation.sql
sp_repldone.sql add Jul 13, 2018
space in files.sql add syntax for shrinking an overgrown file, comments Apr 23, 2019
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 add subscriptions status query to toolbox Apr 5, 2019
stats out of date whileloop.sql
stats out of date.sql better comments Feb 1, 2019
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 clustered index utility scripts Feb 1, 2019
tde status.sql additional lab steps, add tde status as separate file Apr 4, 2019
tempdb data files.sql
test user permissions.sql initial Jul 20, 2017
toolbox-stablestate.zip comment name fix Apr 23, 2019
toolbox.zip
uncommitted transactions.sql initial add Jul 9, 2018
vlfs analysis.sql
volume stats.sql Added Volume Name Nov 20, 2018
worker threads diagnostic.sql update comments Dec 17, 2018
worst query plans.sql bug fix for planhandle length Feb 22, 2019
xevent ringbuffer.sql initial Jul 20, 2017
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.