Skip to content

Commit 7696252

Browse files
author
Ajay Dwivedi
committed
Modified few scripts and documents
Modified few scripts and documents
1 parent 6e4d8d3 commit 7696252

35 files changed

+1255
-89
lines changed
21.5 KB
Binary file not shown.

Backup-Restore/Backup-Restore.ssmssqlproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@
158158
<FullPath>ScriptOut - RESTORE With REPLACE - Multiple Dbs.sql</FullPath>
159159
</FileNode>
160160
<FileNode Name="ScriptOut - RESTORE With REPLACE - Single Db.sql">
161-
<AssociatedConnectionMoniker />
162-
<AssociatedConnSrvName />
161+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:(local):True</AssociatedConnectionMoniker>
162+
<AssociatedConnSrvName>(local)</AssociatedConnSrvName>
163163
<AssociatedConnUserName />
164164
<FullPath>ScriptOut - RESTORE With REPLACE - Single Db.sql</FullPath>
165165
</FileNode>

Baselining/Baselining.ssmssqlproj

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@
7373
<AssociatedConnUserName />
7474
<FullPath>BenchMarking-Storage-Network.sql</FullPath>
7575
</FileNode>
76+
<FileNode Name="BlitzFirst-PerfMon - AsOf - Delta.sql">
77+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:(local):True</AssociatedConnectionMoniker>
78+
<AssociatedConnSrvName>(local)</AssociatedConnSrvName>
79+
<AssociatedConnUserName />
80+
<FullPath>BlitzFirst-PerfMon - AsOf - Delta.sql</FullPath>
81+
</FileNode>
82+
<FileNode Name="BlitzFirst-PerfMon - During.sql">
83+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:LOCALHOST:True</AssociatedConnectionMoniker>
84+
<AssociatedConnSrvName>LOCALHOST</AssociatedConnSrvName>
85+
<AssociatedConnUserName />
86+
<FullPath>BlitzFirst-PerfMon - During.sql</FullPath>
87+
</FileNode>
7688
<FileNode Name="DBA - Start DataCollector.sql">
7789
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:(local):True</AssociatedConnectionMoniker>
7890
<AssociatedConnSrvName>(local)</AssociatedConnSrvName>
@@ -110,8 +122,8 @@
110122
<FullPath>fn_GetLatestCollectionTime.sql</FullPath>
111123
</FileNode>
112124
<FileNode Name="General - IO - WaitStats.sql">
113-
<AssociatedConnectionMoniker />
114-
<AssociatedConnSrvName />
125+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:LOCALHOST:True</AssociatedConnectionMoniker>
126+
<AssociatedConnSrvName>LOCALHOST</AssociatedConnSrvName>
115127
<AssociatedConnUserName />
116128
<FullPath>General - IO - WaitStats.sql</FullPath>
117129
</FileNode>
@@ -145,18 +157,6 @@
145157
<AssociatedConnUserName />
146158
<FullPath>Optimize [DBA] database.sql</FullPath>
147159
</FileNode>
148-
<FileNode Name="PerfMon - AsOf - Delta.sql">
149-
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:(local):True</AssociatedConnectionMoniker>
150-
<AssociatedConnSrvName>(local)</AssociatedConnSrvName>
151-
<AssociatedConnUserName />
152-
<FullPath>PerfMon - AsOf - Delta.sql</FullPath>
153-
</FileNode>
154-
<FileNode Name="PerfMon - During.sql">
155-
<AssociatedConnectionMoniker />
156-
<AssociatedConnSrvName />
157-
<AssociatedConnUserName />
158-
<FullPath>PerfMon - During.sql</FullPath>
159-
</FileNode>
160160
<FileNode Name="PerfMon-Dbatools-DataCollection.sql">
161161
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:(local):True</AssociatedConnectionMoniker>
162162
<AssociatedConnSrvName>(local)</AssociatedConnSrvName>
@@ -275,6 +275,18 @@
275275
</LogicalFolder>
276276
<LogicalFolder Name="Miscellaneous" Type="3" Sorted="true">
277277
<Items>
278+
<FileNode Name="DBA_PerfMon_Collector-Template.xml">
279+
<AssociatedConnectionMoniker />
280+
<AssociatedConnSrvName />
281+
<AssociatedConnUserName />
282+
<FullPath>DBA_PerfMon_Collector-Template.xml</FullPath>
283+
</FileNode>
284+
<FileNode Name="IO-Related-Counters.PerfmonCfg">
285+
<AssociatedConnectionMoniker />
286+
<AssociatedConnSrvName />
287+
<AssociatedConnUserName />
288+
<FullPath>IO-Related-Counters.PerfmonCfg</FullPath>
289+
</FileNode>
278290
<FileNode Name="materials.zip">
279291
<AssociatedConnectionMoniker />
280292
<AssociatedConnSrvName />

Baselining/BenchMarking-Storage-Network.sql

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,33 @@ https://www.brentozar.com/archive/2019/04/free-sql-server-load-testing-tools/
88
https://app.pluralsight.com/library/courses/sql-server-distributed-replay/table-of-contents
99

1010
-- How to Use CrystalDiskMark 7 to Test Your SQL Server’s Storage
11+
https://sqlperformance.com/2015/05/io-subsystem/analyzing-io-performance-for-sql-server
12+
https://sqlperformance.com/2015/08/io-subsystem/diskspd-test-storage
1113
https://www.brentozar.com/archive/2019/11/how-to-use-crystaldiskmark-7-to-test-your-sql-servers-storage/
14+
https://www.overclock.net/forum/20-hard-drives-storage/1231707-can-someone-explain-different-crystaldiskmark-tests.html
15+
https://www.thegeekdiary.com/what-is-hba-queue-depth-and-how-to-check-the-current-queue-depth-value-and-how-to-change-it/
16+
17+
diskspd.exe -b8K -d30 -o4 -t8 -h -r -w25 -L -Z1G -c20G F:\DBA\iotest.dat > DiskSpeedResults.txt
18+
diskspd.exe -d15 -o4 -t4 -b8k -r -L -w50 -c1G testdiskspd
1219

1320
-- Network Load Testing Using iPerf
1421
https://sqlperformance.com/2015/12/monitoring/network-testing-iperf
1522

23+
Setup on Test Server
24+
--------------------
25+
G:\DBA\iperf-3.1.3-win64
26+
27+
On Server =>
28+
iperf3 -s
29+
30+
On Client =>
31+
iperf3 -c tul1sqlpoc01 -t 120 -P 50
32+
-- 120 seconds, 30 threads
33+
34+
-- Method 01: Powershell
35+
& "C:\iperf-3.1.3-win64\iperf3.exe" -c tul1cipxidb3 -t 120 -P 50
36+
& "C:\iperf-3.1.3-win64\iperf3.exe" -s
37+
38+
-- Method 02: Powershell
39+
cmd.exe /c "C:\iperf-3.1.3-win64\iperf3.exe -s"
40+
cmd.exe /c "C:\iperf-3.1.3-win64\iperf3.exe -c tul1cipxidb3 -t 120 -P 50"
1.91 KB
Binary file not shown.
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
Template Path
2-
\\tul1dbapmtdb1\H$\Performance-Issues\DBA_PerfMon_Collector-Template.xml
2+
\\dbatestserver\H$\Performance-Issues\DBA_PerfMon_Collector-Template.xml
3+
\GitHub\SQLDBA-SSMS-Solution\Baselining\DBA_PerfMon_Collector-Template.xml
34

45
LogMan.exe => Manage Performance Monitor & performance logs from the command line.
56
https://ss64.com/nt/logman.html
67
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/logman
78

89
logman import -name “DBA_PerfMon_Collector” -xml “E:\GitHub\SQLDBA-SSMS-Solution\Baselining\DBA_PerfMon_Collector-Template.xml
910
logman update -name “DBA_PerfMon_Collector” -f bin -v mmddhhmm -o "E:\Downloads" -rf 00:05:00 -max 102400
10-
logman start -name “DBA_PerfMon_Collector”
11+
logman start -name “DBA_PerfMon_Collector”
12+
13+
perfmon /sys

BlitzQueries/BlitzQueries.ssmssqlproj

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,20 +104,20 @@
104104
<FullPath>Configure_PSSDiag.sql</FullPath>
105105
</FileNode>
106106
<FileNode Name="CREATE TABLE [dbo].[whatIsRunning].sql">
107-
<AssociatedConnectionMoniker />
108-
<AssociatedConnSrvName />
107+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:LOCALHOST:True</AssociatedConnectionMoniker>
108+
<AssociatedConnSrvName>LOCALHOST</AssociatedConnSrvName>
109109
<AssociatedConnUserName />
110110
<FullPath>CREATE TABLE [dbo].[whatIsRunning].sql</FullPath>
111111
</FileNode>
112112
<FileNode Name="Db-Design-Analysis.sql">
113-
<AssociatedConnectionMoniker />
114-
<AssociatedConnSrvName />
113+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:LOCALHOST:True</AssociatedConnectionMoniker>
114+
<AssociatedConnSrvName>LOCALHOST</AssociatedConnSrvName>
115115
<AssociatedConnUserName />
116116
<FullPath>Db-Design-Analysis.sql</FullPath>
117117
</FileNode>
118118
<FileNode Name="Detect n Reduce High VLFs - All Dbs.sql">
119-
<AssociatedConnectionMoniker />
120-
<AssociatedConnSrvName />
119+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:LOCALHOST:True</AssociatedConnectionMoniker>
120+
<AssociatedConnSrvName>LOCALHOST</AssociatedConnSrvName>
121121
<AssociatedConnUserName />
122122
<FullPath>Detect n Reduce High VLFs - All Dbs.sql</FullPath>
123123
</FileNode>
@@ -146,8 +146,8 @@
146146
<FullPath>Other queries.sql</FullPath>
147147
</FileNode>
148148
<FileNode Name="Perf Counters.sql">
149-
<AssociatedConnectionMoniker />
150-
<AssociatedConnSrvName />
149+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:LOCALHOST:True</AssociatedConnectionMoniker>
150+
<AssociatedConnSrvName>LOCALHOST</AssociatedConnSrvName>
151151
<AssociatedConnUserName />
152152
<FullPath>Perf Counters.sql</FullPath>
153153
</FileNode>
@@ -164,14 +164,14 @@
164164
<FullPath>Querying Deadlocks From System_Health XEvent.sql</FullPath>
165165
</FileNode>
166166
<FileNode Name="ResourceMonitor-Memory-Signals.sql">
167-
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:tul1cipbksdb2:True</AssociatedConnectionMoniker>
168-
<AssociatedConnSrvName>tul1cipbksdb2</AssociatedConnSrvName>
167+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:(local):True</AssociatedConnectionMoniker>
168+
<AssociatedConnSrvName>(local)</AssociatedConnSrvName>
169169
<AssociatedConnUserName />
170170
<FullPath>ResourceMonitor-Memory-Signals.sql</FullPath>
171171
</FileNode>
172172
<FileNode Name="SQL Server 2008 R2 Diagnostic Information Queries.sql">
173-
<AssociatedConnectionMoniker />
174-
<AssociatedConnSrvName />
173+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:LOCALHOST:True</AssociatedConnectionMoniker>
174+
<AssociatedConnSrvName>LOCALHOST</AssociatedConnSrvName>
175175
<AssociatedConnUserName />
176176
<FullPath>SQL Server 2008 R2 Diagnostic Information Queries.sql</FullPath>
177177
</FileNode>
@@ -211,6 +211,12 @@
211211
<AssociatedConnUserName />
212212
<FullPath>Vw_WhoIsActive_Blocking.sql</FullPath>
213213
</FileNode>
214+
<FileNode Name="WaitStats-Short-Period.sql">
215+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:(local):True</AssociatedConnectionMoniker>
216+
<AssociatedConnSrvName>(local)</AssociatedConnSrvName>
217+
<AssociatedConnUserName />
218+
<FullPath>WaitStats-Short-Period.sql</FullPath>
219+
</FileNode>
214220
<FileNode Name="WhatIsRunning.sql">
215221
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:LOCALHOST:True</AssociatedConnectionMoniker>
216222
<AssociatedConnSrvName>LOCALHOST</AssociatedConnSrvName>
Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,45 @@
1-
--System Memory Usage (https://www.sqlskills.com/blogs/jonathan/wow-an-online-calculator-to-misconfigure-your-sql-server-memory/)
2-
SELECT
3-
EventTime,
4-
record.value('(/Record/ResourceMonitor/Notification)[1]', 'varchar(max)') as [Type],
5-
record.value('(/Record/MemoryRecord/AvailablePhysicalMemory)[1]', 'bigint') AS [Avail Phys Mem, Kb],
6-
record.value('(/Record/MemoryRecord/AvailableVirtualAddressSpace)[1]', 'bigint') AS [Avail VAS, Kb]
7-
FROM (
8-
SELECT
9-
DATEADD (ss, (-1 * ((cpu_ticks / CONVERT (float, ( cpu_ticks / ms_ticks )))- [timestamp])/1000), GETDATE()) AS EventTime,
10-
CONVERT (xml, record) AS record
11-
FROM sys.dm_os_ring_buffers
12-
CROSS JOIN sys.dm_os_sys_info
13-
WHERE ring_buffer_type = 'RING_BUFFER_RESOURCE_MONITOR') AS tab
14-
ORDER BY EventTime DESC
1+
-- https://www.sqlskills.com/blogs/jonathan/identifying-external-memory-pressure-with-dm_os_ring_buffers-and-ring_buffer_resource_monitor/
2+
exec sp_HealthCheck 2
3+
4+
select cast(sm.total_physical_memory_kb * 1.0 / 1024 / 1024 as numeric(20,0)) as total_physical_memory_gb,
5+
cast(sm.available_physical_memory_kb * 1.0 / 1024 / 1024 as numeric(20,2)) as available_physical_memory_gb,
6+
cast((sm.total_page_file_kb - sm.available_page_file_kb) * 1.0 / 1024 / 1024 as numeric(20,0)) as used_page_file_gb,
7+
cast(sm.system_cache_kb * 1.0 / 1024 /1024 as numeric(20,2)) as system_cache_gb,
8+
cast((sm.available_physical_memory_kb - sm.system_cache_kb) * 1.0 / 1024 as numeric(20,2)) as free_memory_mb,
9+
sm.system_memory_state_desc,
10+
cast(((sm.total_physical_memory_kb-sm.available_physical_memory_kb) * 100.0) / sm.total_physical_memory_kb as numeric(20,2)) as memory_usage_percentage
11+
from sys.dm_os_sys_memory as sm
12+
13+
-- System Memory Usage
14+
SELECT top 3 EventTime,
15+
record.value('(/Record/ResourceMonitor/Notification)[1]', 'varchar(max)') as [Type],
16+
record.value('(//Record/MemoryRecord/MemoryUtilization)[1]', 'bigint') AS Memory_utilization_Percentage,
17+
cast(record.value('(//Record/MemoryRecord/TotalPhysicalMemory)[1]', 'bigint') * 1.0 / 1024/1024 as decimal(20,2)) as [TotalPhysicalMemory_GB],
18+
cast(record.value('(/Record/MemoryRecord/AvailablePhysicalMemory)[1]', 'bigint') * 1.0 / 1024 as decimal(20,2)) AS [Avail Phys Mem, Mb],
19+
record.value('(/Record/ResourceMonitor/IndicatorsProcess)[1]', 'int') as [IndicatorsProcess],
20+
record.value('(/Record/ResourceMonitor/IndicatorsSystem)[1]', 'int') as [IndicatorsSystem],
21+
cast(record.value('(/Record/MemoryRecord/AvailableVirtualAddressSpace)[1]', 'bigint') * 1.0 / 1024/1024 as decimal(20,2)) AS [Avail VAS, Gb]
22+
FROM ( SELECT DATEADD (ss, (-1 * ((cpu_ticks / CONVERT (float, ( cpu_ticks / ms_ticks ))) - [timestamp])/1000), GETDATE()) AS EventTime,
23+
CONVERT (xml, record) AS record
24+
FROM sys.dm_os_ring_buffers
25+
CROSS JOIN sys.dm_os_sys_info
26+
WHERE ring_buffer_type = 'RING_BUFFER_RESOURCE_MONITOR'
27+
) AS tab
28+
ORDER BY EventTime DESC;
29+
30+
SELECT top 3 record_id, EventTime,
31+
CASE WHEN system_cpu_utilization_post_sp2 IS NOT NULL THEN system_cpu_utilization_post_sp2 ELSE system_cpu_utilization_pre_sp2 END AS system_cpu_utilization,
32+
CASE WHEN sql_cpu_utilization_post_sp2 IS NOT NULL THEN sql_cpu_utilization_post_sp2 ELSE sql_cpu_utilization_pre_sp2 END AS sql_cpu_utilization
33+
FROM ( SELECT record.value('(Record/@id)[1]', 'int') AS record_id,
34+
DATEADD (ms, -1 * (ts_now - [timestamp]), GETDATE()) AS EventTime,
35+
100-record.value('(Record/SchedulerMonitorEvent/SystemHealth/SystemIdle)[1]', 'int') AS system_cpu_utilization_post_sp2,
36+
record.value('(Record/SchedulerMonitorEvent/SystemHealth/ProcessUtilization)[1]', 'int') AS sql_cpu_utilization_post_sp2,
37+
100-record.value('(Record/SchedluerMonitorEvent/SystemHealth/SystemIdle)[1]', 'int') AS system_cpu_utilization_pre_sp2,
38+
record.value('(Record/SchedluerMonitorEvent/SystemHealth/ProcessUtilization)[1]', 'int') AS sql_cpu_utilization_pre_sp2
39+
FROM ( SELECT timestamp, CONVERT (xml, record) AS record, cpu_ticks / (cpu_ticks/ms_ticks) as ts_now
40+
FROM sys.dm_os_ring_buffers cross apply sys.dm_os_sys_info
41+
WHERE ring_buffer_type = 'RING_BUFFER_SCHEDULER_MONITOR'
42+
AND record LIKE '%<SystemHealth>%'
43+
) AS t
44+
) AS t
45+
ORDER BY EventTime desc
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
https://blogs.msdn.microsoft.com/sqlserverstorageengine/2007/04/30/quick-list-of-vldb-maintenance-best-practices/
2-
3-
http://shaunjstuart.com/archive/2013/11/monitoring-for-endless-index-defragmenting/
2+
http://shaunjstuart.com/archive/2013/11/monitoring-for-endless-index-defragmenting/
3+
https://www.youtube.com/watch?v=cN30SRgPkTk&list=PLFUGPe1byxev9kXxmCXvYrLXJ5gxP5JAT&index=49&t=10s
4+
https://www.sqlshack.com/ms-sql-server-backup-optimization/

0 commit comments

Comments
 (0)