🕵️♂️
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************** Find Invalid Records *************** | |
Author: Eitan Blumin | |
****************************************************/ | |
DECLARE | |
@Constraint SYSNAME = 'CK_Name' | |
, @PrintOnly BIT = 0 | |
DECLARE | |
@TableID INT, | |
@CheckDefinition NVARCHAR(MAX), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param | |
( | |
[string] $Subject = "This is a test ticket from Powershell", | |
[string] $Body = "This is test description", | |
[string] $RequesterEmail = "[email protected]", | |
[string] $SourceServer = "SqlDev2016", | |
[string] $SQLVersion = "2016", | |
[string] $SQLEdition = "Developer", | |
[string] $Priority = "low", | |
[string] $StartDate = "2018-04-17 23:30", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------------------------------------------------------- | |
-------- Ultimate Compression Savings Estimation Check --------- | |
---------------------------------------------------------------- | |
-- Author: Eitan Blumin | https://www.eitanblumin.com | |
-- Create Date: 2019-12-08 | |
-- Source: http://bit.ly/SQLCompressionEstimation | |
-- Full Link: https://gist.github.com/EitanBlumin/85cf620f7267b234d677f9c3027fb7ce | |
-- GitHub Repo: https://github.com/MadeiraData/MadeiraToolbox/blob/master/Utility%20Scripts/ultimate_compression_savings_estimation_whole_database.sql | |
-- Blog: https://eitanblumin.com/2020/02/18/ultimate-compression-savings-estimation-script-entire-database/ | |
---------------------------------------------------------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------- | |
------ Generate Clustered Index Recommendations ------- | |
------------------------------------------------------- | |
-- Author: Eitan Blumin | https://www.eitanblumin.com | |
-- More info: https://eitanblumin.com/2019/12/30/resolving-tables-without-clustered-indexes-heaps/ | |
------------------------------------------------------- | |
-- Description: | |
-- ------------ | |
-- This script finds all heap tables, and "guestimates" a clustered index recommendation for each. | |
-- The script implements the following algorithm: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/************************************************************************** | |
Check Index Fragmentation based on Page Fullness and Fill Factor | |
*************************************************************************** | |
Author: Eitan Blumin | https://www.eitanblumin.com | |
Version History: | |
2020-10-20 Added @MaxDOP parameter, and better comments & indentation | |
2020-01-07 First version | |
Description: | |
This script was inspired by Erik Darling's blog post here: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*************************************************************************** | |
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
----------------------------------- | |
TempDB Sizing Check and Remediation | |
----------------------------------- | |
Author: Eitan Blumin | https://www.eitanblumin.com | |
Description: | |
This script makes sure that all TempDB files are equally sized, based on a calculation that takes into consideration | |
the disk volume where the TempDB files are located. | |
This check only works when TempDB files are isolated from other databases and exist on their own dedicated volume. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*======================================================================================================================== | |
-- Description: This query retrieves all the foreign keys in spesific DB that dont have corresponding indexes. | |
-- Scope: Database | |
-- Author: Guy Glantser | https://www.madeiradata.com | |
-- Create Date: 08/04/2012 | |
-- Type: Query Plug&play | |
-- Last Updated On: 08/04/2012 | |
-- Notes: | |
=========================================================================================================================*/ |