Skip to content
SQL Jupyter Notebook PowerShell
Branch: master
Clone or download

Latest commit

wfc1973 Update AutomatedFileGrowthV2.sql
removed troubleshooting select statement
Latest commit 74b78b1 May 22, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitattributes sql lang detection Sep 24, 2018
.gitignore Create .gitignore Mar 3, 2020
AG - Am I Primary.sql cleanup and standardize naming for AG scripts Sep 10, 2018
AG - Health_XEvents pre-2016.sql update ag xevents query or time zone Feb 10, 2020
AG - Health_XEvents.sql update ag xevents query or time zone Feb 10, 2020
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 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
AG - worker threads diagnostic.sql rename this file to start with AG Dec 6, 2019
AutomatedFileGrowthV2.sql Update AutomatedFileGrowthV2.sql May 22, 2020
README.md Update README.md Jan 3, 2019
SSHC - Agent-Security-Files-Backups-DBMail.ipynb Add files via upload May 5, 2020
SSHC - Database.ipynb Add files via upload May 5, 2020
SSHC-HighAvailability.ipynb Add files via upload May 5, 2020
SSHC-Windows-SQLConfig-BasePerf.ipynb Add files via upload May 5, 2020
SSRS rebuild RSExecRole permissions.sql rename SSRS rebuild RSExecRole permissions.sql Jul 12, 2019
Stable State Health Checks.ipynb code correction for Space in Files, added output window header Apr 2, 2020
add database descriptions.sql initial Jul 20, 2017
add error event alerts.sql fix typo Oct 5, 2017
agent job history.sql Update agent job history.sql Oct 8, 2019
audit setup.sql updated for better naming conventions Aug 10, 2018
autogrow change all 1mb growth files.sql comments Nov 19, 2019
autogrow events.sql add startup time May 29, 2019
automated index rebuild old.sql naming convention Apr 9, 2020
automated index rebuild.sql naming convention Apr 10, 2020
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 database master keys.sql Create backup database master keys.sql Feb 6, 2020
backup history oldest latest.sql add state, isreadonly to resultset Aug 9, 2019
backup history.sql updates to backup history Sep 27, 2019
backup progress.sql shows backup progress Mar 31, 2019
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
blocked processes report xevents.sql Create blocked processes report xevents.sql Mar 13, 2020
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
change tracking autocleanup diagnostic.sql update comments Feb 20, 2020
checksum vs hashbytes.sql initial Jul 20, 2017
collect connections.sql naming convention Apr 9, 2020
compress indexes.sql add sample estimation comment Mar 11, 2020
configuration changes history.sql initial Jul 20, 2017
cpu utilization.sql comments Nov 19, 2019
database mail diag.sql maybe i'm not great at merging Mar 13, 2019
database mail profiles.sql Update database mail profiles.sql Mar 15, 2020
database ownership.sql fix potential typo- wrap db name in brackets Jun 5, 2018
database settings info.sql improve comments for simplifying needed database context Mar 23, 2020
dbatools.Copy-DbaLogin.ps1 rename May 8, 2019
deadlocks in xevents.sql prefer .xel Feb 6, 2020
defrag columnstore.sql update comments, add size Oct 11, 2018
defrag.sql Update defrag.sql Jun 29, 2019
dependencies.sql initial Jul 20, 2017
deprecated usage counter.sql initial Jul 20, 2017
dimdate.sql Update dimdate.sql Nov 7, 2019
dm_exec_query_memory_grants.sql initial Jul 20, 2017
dm_exec_session_wait_stats.sql nullif 0 to prevent divide by 0 error Oct 6, 2019
dm_os_performance_counters.sql add Sep 5, 2018
dm_os_wait_stats.sql naming convention Apr 10, 2020
dm_os_waiting_tasks.sql updates to comments, filters Jun 21, 2019
easy passwords.sql better comment Oct 8, 2019
endpoint owners.sql initial Jul 20, 2017
error log.sql Update error log.sql Nov 26, 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 Update find duplicate indexes.sql May 6, 2020
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
fk drop recreate.sql Create fk drop recreate.sql Feb 18, 2020
fk untrusted or disabled check.sql fix for case sensitivity, add all database option May 28, 2019
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 - remoting.ps1 backwards compatible date format for older powershell clients Aug 9, 2019
gather log events.ps1 backwards compatible date format for older powershell clients Aug 9, 2019
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 minor cosmetics, add service uptime May 22, 2019
indirect checkpoints enable.sql initial checkin Nov 20, 2017
install failover clustering features.ps1 initial Sep 11, 2017
instant_file_initialization.sql improve comments for simplifying needed database context Mar 23, 2020
job - Backup Failure Notifications.sql add local server time stamp to email output May 8, 2020
job - File Growth Management.sql Rename Job - File Growth Management.sql to job - File Growth Manageme… Dec 15, 2019
job - Space in Files Monitoring.sql Update job - Space in Files Monitoring.sql Dec 26, 2019
job - Volume Stats Monitoring for Production.sql clean up comments, formatting Dec 15, 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 comment, todo upgrades Nov 17, 2019
job - setup database audit.sql setup database audit job script Aug 10, 2018
job - startup failures.sql naming convention Apr 9, 2020
job failure notifications.sql standardize these scripts to be more like job owners, db owners, etc Nov 28, 2018
job owners.sql better filter and sample data Sep 10, 2018
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 initial Jul 20, 2017
lab - FORMATMESSAGE in SQL2016.sql rename/organize Nov 9, 2017
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 naming convention Apr 10, 2020
lab - basic error table.sql demonstrate issue with THROW only returning second (useless) error. Jul 30, 2018
lab - cdc 101.sql Create lab - cdc 101.sql Jan 6, 2020
lab - clustered key design.sql new file Feb 19, 2018
lab - concat_ws.sql update for lab demo Feb 15, 2018
lab - cte 101.sql add labs May 6, 2020
lab - cte with dimdate.sql add labs May 6, 2020
lab - datetime conversion from datetime to datetimeoffsets.sql Create lab - datetime conversion from datetime to datetimeoffsets.sql Dec 6, 2019
lab - deadlock part 1.sql add comments Oct 6, 2019
lab - deadlock part 2.sql add comments Oct 6, 2019
lab - docker win AG.ps1 add update labs Oct 20, 2019
lab - docker.ps1 add update labs Oct 20, 2019
lab - dynamic data masking.sql rename/organize Nov 9, 2017
lab - execute as.sql add lab for execute as Jun 1, 2019
lab - filetable demo.sql rename/organize Nov 9, 2017
lab - fk untrusted or disabled check.ipynb Update lab - fk untrusted or disabled check.ipynb Jul 9, 2019
lab - fk untrusted or disabled check.sql fix for case sensitivity May 28, 2019
lab - float as pk problems.sql update from labs Nov 15, 2019
lab - fragmented table int.sql options, comments Oct 10, 2019
lab - fragmented table newsequentialid.sql options, comments Oct 10, 2019
lab - fragmented table.sql options, comments Oct 10, 2019
lab - implicit conversion.sql Update lab - implicit conversion.sql Oct 1, 2019
lab - materialized view with columnstore.sql minor updates Aug 8, 2019
lab - memory optimized table.sql Create lab - memory optimized table.sql Aug 8, 2019
lab - missing index setup demo.sql rename/organize Nov 9, 2017
lab - nested sproc tran rollback commit.sql Create lab - nested sproc tran rollback commit.sql Jan 7, 2020
lab - nonsequentialguid.sql rename, update lab files Oct 31, 2019
lab - optimize_for_sequential_key testing.sql update from labs Nov 15, 2019
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 Update lab - pre2016 correct time zone conversion from UTC.sql Oct 2, 2019
lab - replaceFloatWithDecimal.sql rename for proper git sorting Nov 10, 2017
lab - restore wideworldimporters.sql Update lab - restore wideworldimporters.sql Jan 6, 2020
lab - resumeable index maintenance.sql Create lab - resumeable index maintenance.sql Oct 5, 2019
lab - security p1.sql Update lab - security p1.sql Oct 4, 2019
lab - security p2.sql add from the security preso Sep 9, 2019
lab - sequence permissions.sql Create lab - sequence permissions.sql Jul 16, 2019
lab - sql agent execution lab.sql
lab - string truncation error message improvement in SQL 2019.sql Update lab - string truncation error message improvement in SQL 2019.sql Jul 26, 2019
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 Update lab - time zone.sql Oct 2, 2019
lab - translate syntax.sql initial checkin for 2017 demo syntax scripts Feb 14, 2018
last known DBCC CHECKDB.sql better comment for 2014+ feature Oct 8, 2019
limit number of error log files.sql Create limit number of error log files.sql Oct 8, 2019
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 improve comments for simplifying needed database context Mar 23, 2020
modules vs routines.sql comment improvement Sep 26, 2017
move system databases.sql initial Jul 20, 2017
multiserver backup history.sql updates to backup history Sep 27, 2019
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 initial Jul 20, 2017
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 improve comments for simplifying needed database context Mar 23, 2020
permissions for readonly admin accounts.sql Update permissions for readonly admin accounts.sql Oct 21, 2019
public permissions.sql Update public permissions.sql Mar 6, 2018
record_dm_io_virtual_file_stats.sql naming convention Apr 9, 2020
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 Update restore.sql May 6, 2020
sas credential.sql Update sas credential.sql Dec 26, 2019
schema dependencies.sql Create schema dependencies.sql Mar 18, 2020
script ssisdb env.sql Update script ssisdb env.sql Mar 27, 2019
security Script databases.sql minor updates to new syntax Aug 9, 2019
security Script servers.sql minor updates to new syntax Aug 9, 2019
security check msdb role members.sql additions/improvements based on recent health checks Oct 7, 2019
security check sysadmin members.sql additions/improvements based on recent health checks Oct 7, 2019
security group members.sql add powershell alternative May 31, 2019
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 - SQL2000.sql tweak order by, rename to conform May 7, 2019
sessions and requests - dump to table.sql add comment Mar 13, 2020
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 add comment Mar 13, 2020
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 minor changes, add additional helpful columns May 23, 2019
sp_GetAGInformation.sql initial Jul 20, 2017
sp_repldone.sql add Jul 13, 2018
space in files.sql bug in the bug fix Aug 15, 2019
sproc sessions and requests.sql initial Jul 20, 2017
ssis events.sql initial Jul 20, 2017
ssisdb execution query.sql Update ssisdb execution query.sql Mar 28, 2020
ssisdb history cleanup.sql update comments Jul 16, 2019
ssisdb package history.sql add ssis package version history Aug 2, 2018
ssrs Subscription catalog inventory.sql modify path, add order by May 16, 2019
ssrs Subscription failure emails.sql make generic Jul 30, 2018
ssrs Subscription start jobs.sql rename for proper git sorting Nov 10, 2017
ssrs subscription failure logs.sql Update ssrs subscription failure logs.sql Jun 24, 2019
ssrs subscriptions status.sql modify commented out filters May 16, 2019
stats out of date whileloop.sql better comments around incremental stats compatiblity Oct 8, 2019
stats out of date.sql improve comments for simplifying needed database context Mar 23, 2020
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 improve comments for simplifying needed database context Mar 23, 2020
tde status.sql additional lab steps, add tde status as separate file Apr 4, 2019
tempdb data files.sql minor cosmetics, add service uptime May 22, 2019
tempdb space used diagnostic.sql Create tempdb space used diagnostic.sql Sep 24, 2019
test user permissions.sql initial Jul 20, 2017
toolbox-stablestate.zip update toolbox with latest autozips Mar 28, 2020
toolbox.zip Update toolbox.zip May 8, 2020
uncommitted transactions.sql initial add Jul 9, 2018
vlfs analysis.sql remove a debug line Sep 13, 2019
volume stats.sql Added Volume Name Nov 20, 2018
worst query plans.sql improve desired database filtering and comments, place queryplan last… Mar 28, 2020
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.