Skip to content

Instantly share code, notes, and snippets.

🕵
Figuring it out

Eitan Blumin EitanBlumin

🕵
Figuring it out
Block or report user

Report or block EitanBlumin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@EitanBlumin
EitanBlumin / Get Top Query Plans with Warnings from Cache.sql
Last active Jan 29, 2020
Get Top Query Plans with Warnings from SQL Plan Cache
View Get Top Query Plans with Warnings from Cache.sql
/***************************************************************************
Get Top Query Plans with Warnings from Cache
--------------------------------------------
Author: Eitan Blumin | https://www.eitanblumin.com
Change Log:
2020-01-29 - Added a few more warnings from sp_BlitzCache: https://www.brentozar.com/blitzcache/
2020-01-12 - First version
****************************************************************************/
DECLARE
@EitanBlumin
EitanBlumin / check_untrusted_check_constraints.sql
Last active Feb 19, 2020
Find and check untrusted Check Constraints in all active databases
View check_untrusted_check_constraints.sql
IF OBJECT_ID('tempdb..#tmp') IS NOT NULL DROP TABLE #tmp;
CREATE TABLE #tmp (DBName SYSNAME, SchemaName SYSNAME, TableName SYSNAME, FullTableName AS QUOTENAME(SchemaName) + N'.' + QUOTENAME(TableName), UntrustedObject SYSNAME);
DECLARE @CMD NVARCHAR(MAX)
SET @CMD = N'SELECT DB_NAME(), OBJECT_SCHEMA_NAME(parent_object_id), OBJECT_NAME(parent_object_id), [name]
FROM sys.check_constraints
WHERE is_not_trusted = 1 AND is_not_for_replication = 0 AND is_disabled = 0;'
IF CONVERT(varchar(300),SERVERPROPERTY('Edition')) = 'SQL Azure'
BEGIN
@EitanBlumin
EitanBlumin / helper_script_for_adding_schemabinding_to_scalar_functions.sql
Last active Feb 19, 2020
Helper T-SQL script for adding SCHEMABINDING on scalar functions (checks in ALL databases on the server)
View helper_script_for_adding_schemabinding_to_scalar_functions.sql
/*
Author: Eitan Blumin | https://www.eitanblumin.com
Description:
Helper T-SQL script for adding SCHEMABINDING on scalar functions (checks in ALL databases on the server)
Added support for Azure SQL DB: Performs the same check across schemas instead of across databases
Instructions:
1. Run the script to detect all scalar functions with disabled SCHEMABINDING, that can potentially have it enabled.
View Check Index Fragmentation Based on Page Fullness and Fill Factor.sql
/**************************************************************************
Check Index Fragmentation based on Page Fullness and Fill Factor
***************************************************************************
Author: Eitan Blumin | https://www.eitanblumin.com
Version History:
2020-01-07 First version
Description:
This script was inspired by Erik Darling's blog post here:
https://www.erikdarlingdata.com/2019/10/because-your-index-maintenance-script-is-measuring-the-wrong-thing/
@EitanBlumin
EitanBlumin / Generate recommendations for clustered indexes.sql
Last active Feb 19, 2020
Use existing non-clustered index usage stats, and missing index stats, to generate clustered-index recommendations for heap tables
View Generate recommendations for clustered indexes.sql
-------------------------------------------------------
------ Generate Clustered Index Recommendations -------
-------------------------------------------------------
-- Author: Eitan Blumin | https://www.eitanblumin.com
-------------------------------------------------------
-- Description:
-- ------------
-- This script finds all heap tables, and "guestimates" a clustered index recommendation for each.
-- The script implements the following algorithm:
--
@EitanBlumin
EitanBlumin / ultimate_compression_savings_estimation_whole_database.sql
Last active Feb 19, 2020
This ultimate script performs compression savings estimation check for an ENTIRE database, includes comparison between PAGE and ROW compression types, cautionary table size checks, AND it generates the remediation scripts for you!
View ultimate_compression_savings_estimation_whole_database.sql
----------------------------------------------------------------
-------- Ultimate Compression Savings Estimation Check ---------
----------------------------------------------------------------
-- Author: Eitan Blumin | https://www.eitanblumin.com
-- Create Date: 2019-12-08
-- Source: https://gist.github.com/EitanBlumin/85cf620f7267b234d677f9c3027fb7ce
----------------------------------------------------------------
-- Description:
-- ------------
-- This script performs compression savings estimation check for both PAGE and ROW
@EitanBlumin
EitanBlumin / zendesk_open_ticket.ps1
Created Aug 22, 2019
Powershell script to open Zendesk support tickets, or add comment to an existing ticket (based on requester and subject). Useful for automatic monitoring and alerting systems.
View zendesk_open_ticket.ps1
param
(
[string] $Subject = "This is a test ticket from Powershell",
[string] $Body = "This is test description",
[string] $RequesterEmail = "dbmonitor@madeiradata.com",
[string] $SourceServer = "SqlDev2016",
[string] $SQLVersion = "2016",
[string] $SQLEdition = "Developer",
[string] $Priority = "low",
[string] $StartDate = "2018-04-17 23:30",
@EitanBlumin
EitanBlumin / Find Invalid Records by Check Constraint.sql
Last active Jul 31, 2019
Find the records which cause your not trusted check constraint to fail
View Find Invalid Records by Check Constraint.sql
/************** Find Invalid Records ***************
Author: Eitan Blumin
****************************************************/
DECLARE
@Constraint SYSNAME = 'CK_Name'
, @PrintOnly BIT = 0
DECLARE
@TableID INT,
@CheckDefinition NVARCHAR(MAX),
View Parse Vulnerability Assessment Results File into HTML.sql
/******************************************************************
Parse SQL Vulnerability Assessment Tool Results
***********************************************
Author: Eitan Blumin | https://www.eitanblumin.com
Description:
Use this script to parse a Vulnerability Assessment Tool
results file into a relational structure.
This will output the T-SQL queries used by VAT behind the scenes
and their respective meta-data, as displayed in the VAT.
View trello_cards_to_github_issues.ps1
param (
[Parameter(Mandatory)][string] $GitHubToken,
[Parameter(Mandatory)][string] $GitHubOwner,
[Parameter(Mandatory)][string] $GitHubRepo,
[Parameter(Mandatory)][string] $SourceTrelloJsonFile,
[string[]] $TrelloLists,
[bool] $UpdateExistingIssuesByTitle = $true,
[bool] $AddNonExistingIssues = $true,
[bool] $Logging = $true
)
You can’t perform that action at this time.