Skip to content

Commit 40cd75e

Browse files
Merge pull request #935 from dataplat/moreinstancechecks
Some instance checks Some perf fixes, some development fixes
2 parents 76accc1 + 499c1a0 commit 40cd75e

File tree

14 files changed

+328
-475
lines changed

14 files changed

+328
-475
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@
157157
"powershell.codeFolding.enable": true,
158158
"powershell.codeFolding.showLastLine": true,
159159
"powershell.enableReferencesCodeLens": true,
160-
"powershell.powerShellDefaultVersion": "PowerShell Core 7 (x64)",
161160
"editor.formatOnSave": true,
162161
"editor.formatOnSaveMode": "file",
163162
"editor.formatOnPaste": true,
@@ -173,5 +172,5 @@
173172
}
174173
}
175174
},
176-
"postCreateCommand": "pwsh -c '/workspace/developing/Howto.md'"
175+
"postCreateCommand": ""
177176
}

containers/JessAndBeard.psm1

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2246,6 +2246,7 @@ function Invoke-PerfAndValidateCheck {
22462246
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingCmdletAliases', 'cls', Justification = 'Dont tell me what to do')]
22472247
[CmdletBinding()]
22482248
param($Checks, [switch]$PerfDetail , [switch]$showTestResults)
2249+
$SQLInstances = $dbachecks1, $dbachecks2, $dbachecks3 = 'dbachecks1', 'dbachecks2', 'dbachecks3'
22492250
$password = ConvertTo-SecureString "dbatools.IO" -AsPlainText -Force
22502251
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "sqladmin", $password
22512252
if ($showTestResults) {
@@ -2263,6 +2264,8 @@ function Invoke-PerfAndValidateCheck {
22632264
}
22642265

22652266
$originalCodetrace = Trace-Script -ScriptBlock $originalCode
2267+
Remove-Module Pester
2268+
Import-Module Pester -MinimumVersion 5.0.0 -Global
22662269
$NewCodetrace = Trace-Script -ScriptBlock $NewCode
22672270

22682271
$originalCodeMessage = "With original Code it takes {0} MilliSeconds" -f $originalCodetrace.StopwatchDuration.TotalMilliseconds
@@ -2434,7 +2437,7 @@ The Total Tests Skipped are the same {0} {1}
24342437
$message = "
24352438
Let's take a look at the slowest code as well "
24362439
Write-PSFMessage -Message $Message -Level Output
2437-
$NewCodetrace.Top50SelfDuration| Select SelfPercent,HitCount,Line,Function }
2440+
$NewCodetrace.Top50SelfDuration| Select SelfPercent,HitCount,Line,Function, Text }
24382441
}
24392442

24402443
Set-PSFConfig -Module JessAndBeard -Name shallweplayagame -Value $true -Initialize -Description "Whether to ask or not" -ModuleExport

developing/Robs-Instance.ps1

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
$Checks = 'ErrorLogCount', 'TraceFlagsNotExpected', 'TraceFlagsExpected', 'XESessionRunningAllowed', 'XESessionRunning', 'XESessionRunningAllowed', 'XESessionExists', 'XESessionStopped', 'XpCmdShellDisabled', 'WhoIsActiveInstalled', 'CLREnabled', 'TwoDigitYearCutoff', 'MaxDopInstance', 'ErrorLogCount', 'ModelDbGrowth', 'DefaultBackupCompression', 'SaExist', 'SaDisabled', 'SaRenamed', 'DefaultFilePath', 'AdHocDistributedQueriesEnabled', 'AdHocWorkload', 'DefaultTrace', 'OleAutomationProceduresDisabled', 'CrossDBOwnershipChaining', 'ScanForStartupProceduresDisabled', 'RemoteAccessDisabled', 'SQLMailXPsDisabled', 'DAC', 'OLEAutomation'
1+
$Checks = 'ErrorLogCount', 'XESessionExists', 'XESessionStopped', 'XpCmdShellDisabled', 'WhoIsActiveInstalled', 'CLREnabled', 'TwoDigitYearCutoff', 'MaxDopInstance', 'ErrorLogCount', 'ModelDbGrowth', 'DefaultBackupCompression', 'SaExist', 'SaDisabled', 'SaRenamed', 'DefaultFilePath', 'AdHocDistributedQueriesEnabled', 'AdHocWorkload', 'DefaultTrace', 'OleAutomationProceduresDisabled', 'CrossDBOwnershipChaining', 'ScanForStartupProceduresDisabled', 'RemoteAccessDisabled', 'SQLMailXPsDisabled', 'DAC', 'OLEAutomation', 'ServerNameMatch', 'OrphanedFile', 'MaxMemory', 'NetworkLatency'
22

33
$Checks = 'XESessionRunningAllowed', 'XESessionRunning', 'XESessionRunningAllowed', 'XESessionExists', 'XESessionStopped', 'XpCmdShellDisabled'
44
$Checks = 'TraceFlagsNotExpected', 'TraceFlagsExpected'
5+
$Checks = 'ServerNameMatch'
6+
$Checks = 'BackupPathAccess'
7+
$Checks = 'LatestBuild'
8+
$Checks = 'NetworkLatency'
9+
$Checks = 'LinkedServerConnection'
10+
$Checks = 'MaxMemory'
11+
$Checks = 'OrphanedFile'
512

613
Invoke-PerfAndValidateCheck -Checks $Checks
714
Invoke-PerfAndValidateCheck -Checks $Checks -PerfDetail
@@ -21,6 +28,18 @@ Set-DbcConfig -Name policy.xevent.requiredrunningsession -Value system_health ,
2128
Set-DbcConfig -Name policy.xevent.validrunningsession -Value system_health , AlwaysOn_health
2229
Set-DbcConfig -Name policy.xevent.validrunningsession -Value AlwaysOn_health
2330

31+
32+
$SQLInstances = $dbachecks1, $dbachecks2, $dbachecks3 = 'dbachecks1', 'dbachecks2', 'dbachecks3'
33+
$password = ConvertTo-SecureString "dbatools.IO" -AsPlainText -Force
34+
$cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "sqladmin", $password
35+
$show = 'All'
36+
2437
$traci = Trace-Script -ScriptBlock {
2538
$v5code = Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $false -Show $show -PassThru
26-
}
39+
}
40+
$traci1 = Trace-Script -ScriptBlock {
41+
$v5code = Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $false -Show $show -PassThru
42+
}
43+
$traci = Trace-Script -ScriptBlock {
44+
$v4code = Invoke-DbcCheck -SqlInstance $Sqlinstances -SqlCredential $cred -Check $Checks -legacy $true -Show $show -PassThru
45+
}

0 commit comments

Comments
 (0)