Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
--- Index Scan/Seek/Lookup/Update Breakdown | |
SELECT | |
DB_NAME([ddius].[database_id]) AS [database name], | |
s.[name] AS 'Schema_Name', | |
OBJECT_NAME([ddius].[object_id]) AS [Table name], | |
CASE | |
WHEN ddius.index_id=1 THEN '*'+[i].[name]+'*' | |
ELSE [i].[name] | |
END AS [index name], |
This file contains 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
--- Simple | |
SELECT | |
@@SERVERNAME AS 'Server', | |
DB_NAME(dbid) as 'Database', | |
COUNT(dbid) as 'Number Of Open Connections' | |
FROM | |
sys.sysprocesses | |
WHERE | |
dbid > 0 | |
GROUP BY |
This file contains 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
-- Blocked Process Report | |
CREATE EVENT SESSION [Blocked Process Report] ON SERVER | |
ADD EVENT sqlserver.blocked_process_report | |
ADD TARGET package0.event_file(SET filename=N'd:\Traces\Blocked-Process-Report.xel',max_file_size=(1024),max_rollover_files=(4)) | |
WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=120 SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=ON) | |
GO | |
-- Deadlocks | |
CREATE EVENT SESSION [deadlock_capture] ON SERVER | |
ADD EVENT sqlserver.database_xml_deadlock_report( |
This file contains 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
--- 1 Work In Process | |
--- Ignore me - This is not the query you are looking for | |
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED | |
USE master | |
GO | |
SELECT | |
sp.session_Id AS 'Spid' | |
,er.blocking_session_id AS 'BlockedBy' | |
,DB_NAME(er.database_id) AS 'Database' |
This file contains 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
SELECT | |
HostName, | |
"OS UserName", | |
Login, | |
spid, | |
"Database", | |
TableID, | |
"Table Name", | |
IndID, | |
"Lock Type", |
This file contains 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
DECLARE @Starttime DATETIME | |
DECLARE @EndTime DATETIME | |
SET @Starttime = DATEADD(hour ,-1,GETDATE()) | |
SET @Endtime = GETDATE() | |
DROP TABLE IF EXISTS #query1 | |
--- Max Duration | |
SELECT TOP (100) | |
p.query_id query_id, |
This file contains 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
# The new [microsoft.data.sqlclient] provider allows new features such as | |
# New Azure AD Authentication Methods | |
# BulkCopy Speedups | |
# DNS Resiliency | |
# Data Classification | |
# UTF-8 Support | |
# Connection Statistics - | |
# https://docs.microsoft.com/en-us/sql/connect/ado-net/sql/provider-statistics-sql-server?view=sql-server-ver15 | |
# MS Docs are here |
This file contains 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
# https://vexx32.github.io/2018/10/26/Anonymous-Functions/ | |
function Retry() | |
{ | |
param( | |
[Parameter(Mandatory=$true)][Action]$action, | |
[Parameter(Mandatory=$false)][int]$maxAttempts = 3 | |
) | |
$attempts=1 |
This file contains 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
Download the CLI Version of NuGet | |
https://dist.nuget.org/win-x86-commandline/latest/nuget.exe | |
--Create Work Paths | |
md c:\nuget | |
md c:\nuget\source | |
md c:\nuget\publish | |
-- One-Time - Create local NuGet Repo/feed using a local drive path | |
cd c:\nuget |