Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6e4d8d3

Browse files
author
Ajay Dwivedi
committed
Added few Scripts
Added few Scripts
1 parent da122fa commit 6e4d8d3

22 files changed

+462
-69
lines changed

‎.vs/SQLDBA-SSMS Solution/v15/.ssms_suo

0 Bytes
Binary file not shown.

‎Baselining/Baselining.ssmssqlproj

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@
1515
<ConnectionProtocol>NotSpecified</ConnectionProtocol>
1616
<ApplicationName>Microsoft SQL Server Management Studio - Query</ApplicationName>
1717
</ConnectionNode>
18+
<ConnectionNode Name="LOCALHOST:CORPORATE\adwivedi">
19+
<Created>2020年03月09日T23:04:01.1172366+05:30</Created>
20+
<Type>SQL</Type>
21+
<Server>LOCALHOST</Server>
22+
<UserName />
23+
<Authentication>Windows Authentication</Authentication>
24+
<InitialDB>DBA</InitialDB>
25+
<LoginTimeout>30</LoginTimeout>
26+
<ExecutionTimeout>0</ExecutionTimeout>
27+
<ConnectionProtocol>NotSpecified</ConnectionProtocol>
28+
<ApplicationName>Microsoft SQL Server Management Studio - Query</ApplicationName>
29+
</ConnectionNode>
1830
<ConnectionNode Name="TUL1MDUTWDS1:CORPORATE\adwivedi">
1931
<Created>2019年09月13日T15:00:34.5134664+05:30</Created>
2032
<Type>SQL</Type>
@@ -55,6 +67,18 @@
5567
<AssociatedConnUserName />
5668
<FullPath>Baseline with [sp_BlitzFirst].sql</FullPath>
5769
</FileNode>
70+
<FileNode Name="BenchMarking-Storage-Network.sql">
71+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:LOCALHOST:True</AssociatedConnectionMoniker>
72+
<AssociatedConnSrvName>LOCALHOST</AssociatedConnSrvName>
73+
<AssociatedConnUserName />
74+
<FullPath>BenchMarking-Storage-Network.sql</FullPath>
75+
</FileNode>
76+
<FileNode Name="DBA - Start DataCollector.sql">
77+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:(local):True</AssociatedConnectionMoniker>
78+
<AssociatedConnSrvName>(local)</AssociatedConnSrvName>
79+
<AssociatedConnUserName />
80+
<FullPath>DBA - Start DataCollector.sql</FullPath>
81+
</FileNode>
5882
<FileNode Name="Export-Excel.sql">
5983
<AssociatedConnectionMoniker />
6084
<AssociatedConnSrvName />
@@ -97,6 +121,12 @@
97121
<AssociatedConnUserName />
98122
<FullPath>Generate-Workload-StackOverflow.sql</FullPath>
99123
</FileNode>
124+
<FileNode Name="High-Memory-Usage-Alert-Response.sql">
125+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:LOCALHOST:True</AssociatedConnectionMoniker>
126+
<AssociatedConnSrvName>LOCALHOST</AssociatedConnSrvName>
127+
<AssociatedConnUserName />
128+
<FullPath>High-Memory-Usage-Alert-Response.sql</FullPath>
129+
</FileNode>
100130
<FileNode Name="Job [DBA - FirstResponderKit_Collect_PerformanceData].sql">
101131
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:(local):True</AssociatedConnectionMoniker>
102132
<AssociatedConnSrvName>(local)</AssociatedConnSrvName>
@@ -145,12 +175,6 @@
145175
<AssociatedConnUserName />
146176
<FullPath>sp_Blitz Views Extra.sql</FullPath>
147177
</FileNode>
148-
<FileNode Name="SQLQuery1.sql">
149-
<AssociatedConnectionMoniker />
150-
<AssociatedConnSrvName />
151-
<AssociatedConnUserName />
152-
<FullPath>SQLQuery1.sql</FullPath>
153-
</FileNode>
154178
<FileNode Name="StackOverflow-TopQueries.sql">
155179
<AssociatedConnectionMoniker />
156180
<AssociatedConnSrvName />
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
-- How to Check Performance on a New SQL Server
2+
https://www.brentozar.com/archive/2018/08/how-to-check-performance-on-a-new-sql-server/
3+
4+
-- Free SQL Server Load Testing Tools
5+
https://www.brentozar.com/archive/2019/04/free-sql-server-load-testing-tools/
6+
7+
-- Simulating Production Workloads with SQL Server Distributed Replay
8+
https://app.pluralsight.com/library/courses/sql-server-distributed-replay/table-of-contents
9+
10+
-- How to Use CrystalDiskMark 7 to Test Your SQL Server’s Storage
11+
https://www.brentozar.com/archive/2019/11/how-to-use-crystaldiskmark-7-to-test-your-sql-servers-storage/
12+
13+
-- Network Load Testing Using iPerf
14+
https://sqlperformance.com/2015/12/monitoring/network-testing-iperf
15+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
set nocount on;
2+
3+
declare @result int;
4+
if object_id('tempdb..#output') is not null
5+
drop table #output;
6+
create table #output (id int identity(1,1), output varchar(2000));
7+
declare @body varchar(max);
8+
declare @iscollectorstarted bit = 0;
9+
10+
-- check status
11+
insert #output
12+
exec @result = xp_cmdshell 'logman query SQLDBA' -- W:\PerfMon
13+
14+
if not exists (select * from #output where output like 'Status:%Running')
15+
begin
16+
truncate table #output;
17+
-- start data collector
18+
insert #output
19+
exec @result = xp_cmdshell 'logman start SQLDBA' -- W:\PerfMon
20+
if (@result = 0)
21+
set @iscollectorstarted = 1;
22+
end
23+
24+
--select @result as [@result];
25+
--delete from #output where output is null;
26+
--select * from #output where output like 'Status:%Running'
27+
--select * from #output --where output in ('The command completed successfully.','The operator or administrator has refused the request.')
28+
29+
SET @body = '<h3>SQLDBA Data Collector has been started</h3><br>
30+
<p><br>
31+
Thanks & Regards,<br>
32+
SQLAlerts <br>
33+
-- Alert coming from job [DBA - Start DataCollector]<br>
34+
';
35+
36+
if @iscollectorstarted = 1
37+
begin
38+
39+
EXEC msdb.dbo.sp_send_dbmail
40+
@recipients = 'ajay.dwivedi2007@gmail.com;',
41+
@subject = 'SQLDBA Data Collector Started',
42+
@body_format = 'HTML',
43+
@body = @body;
44+
end
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Hi @User,
2+
3+
There are variety of components within SQL Server itself that take memory, and are not accounted in Max Memory Setting.
4+
5+
Below are 2 blog posts by MCM/MVP Jonathan Kehayias that explain the same in much better word than we can do.
6+
7+
https://www.sqlskills.com/blogs/jonathan/how-much-memory-does-my-sql-server-actually-need/
8+
https://www.sqlskills.com/blogs/jonathan/wow-an-online-calculator-to-misconfigure-your-sql-server-memory/
9+
10+
Based on Jonathan’s recommendations, SQL Server experts(MVPs) have created powershell cmdlet Set-DbaMaxMemory/Test-DbaMaxMemory as part of DBATools module. We use this cmdlet to verify the memory/DOP settings.
11+
12+
Kindly let me know in case of any query.

‎Baselining/SQLQuery1.sql

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Save and Restore NTFS permissions using ICACLS
2+
http://virot.eu/save-and-restore-ntfs-permissions-using-icacls/
3+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
https://sqlrambling.net/2016/12/01/ssisdb-and-catalog-part-3-copying-a-package-between-servers/
2+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
;WITH T_History as
3+
(
4+
SELECT bs.database_name as dbName
5+
,cast(max(bs.backup_size) / 1024 /1024 as decimal(20,2)) as backup_size_MB
6+
,cast(max(bs.compressed_backup_size) / 1024 /1024 as decimal(20,2)) as compressed_backup_size_MB
7+
FROM msdb.dbo.backupmediafamily AS bmf
8+
INNER JOIN msdb.dbo.backupset AS bs ON bmf.media_set_id = bs.media_set_id
9+
WHERE bs.type in ('D')
10+
GROUP BY database_name
11+
)
12+
,t_filtered as (
13+
select d.name as dbName, backup_size_MB, compressed_backup_size_MB
14+
from sys.databases d
15+
left join T_History h
16+
on h.dbName = d.name
17+
)
18+
select 'Full-Backup' as BackupType, sum(f.backup_size_MB)/1024 as backup_size_GB, sum(f.compressed_backup_size_MB)/1024 as compressed_backup_size_GB
19+
from t_filtered f;
20+
go
21+
22+
23+
;WITH T_History as
24+
(
25+
SELECT bs.database_name as dbName
26+
,cast(max(bs.backup_size) / 1024 /1024 as decimal(20,2)) as backup_size_MB
27+
,cast(max(bs.compressed_backup_size) / 1024 /1024 as decimal(20,2)) as compressed_backup_size_MB
28+
FROM msdb.dbo.backupmediafamily AS bmf
29+
INNER JOIN msdb.dbo.backupset AS bs ON bmf.media_set_id = bs.media_set_id
30+
WHERE bs.type in ('L')
31+
AND bs.backup_finish_date >= DATEADD(DAY,-1,GETDATE())
32+
GROUP BY database_name
33+
)
34+
,t_filtered as (
35+
select d.name as dbName, backup_size_MB, compressed_backup_size_MB
36+
from sys.databases d
37+
left join T_History h
38+
on h.dbName = d.name
39+
)
40+
select 'Log-Backup' as BackupType, sum(f.backup_size_MB)/1024 as backup_size_GB, sum(f.compressed_backup_size_MB)/1024 as compressed_backup_size_GB
41+
from t_filtered f;
42+
go

‎InstanceMigration/InstanceMigration.ssmssqlproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,24 @@
4949
<AssociatedConnUserName />
5050
<FullPath>Check-Space-Requirement.sql</FullPath>
5151
</FileNode>
52+
<FileNode Name="Copy-Files-Folders-Permissions.sql">
53+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:(local):True</AssociatedConnectionMoniker>
54+
<AssociatedConnSrvName>(local)</AssociatedConnSrvName>
55+
<AssociatedConnUserName />
56+
<FullPath>Copy-Files-Folders-Permissions.sql</FullPath>
57+
</FileNode>
58+
<FileNode Name="Copy-SSIS-Packages.sql">
59+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:LOCALHOST:True</AssociatedConnectionMoniker>
60+
<AssociatedConnSrvName>LOCALHOST</AssociatedConnSrvName>
61+
<AssociatedConnUserName />
62+
<FullPath>Copy-SSIS-Packages.sql</FullPath>
63+
</FileNode>
64+
<FileNode Name="Estimate-Backup-Size-Full.sql">
65+
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:(local):True</AssociatedConnectionMoniker>
66+
<AssociatedConnSrvName>(local)</AssociatedConnSrvName>
67+
<AssociatedConnUserName />
68+
<FullPath>Estimate-Backup-Size-Full.sql</FullPath>
69+
</FileNode>
5270
<FileNode Name="Get-UserObjects-in-SystemDb.sql">
5371
<AssociatedConnectionMoniker>8c91a03d-f9b4-46c0-a305-b5dcc79ff907:(local):True</AssociatedConnectionMoniker>
5472
<AssociatedConnSrvName>(local)</AssociatedConnSrvName>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /