Skip to content
Permalink
Browse files

1.0.43

  • Loading branch information...
potatoqualitee committed Sep 10, 2019
1 parent 91829ec commit 0ff6c7697660c058c3f0dcf5fc1ff7972d483c8f
Showing with 113 additions and 26 deletions.
  1. +70 βˆ’7 allcommands.ps1
  2. +17 βˆ’1 bin/dbatools-index.json
  3. 0 ...icquery/{SQLServerDiagnosticQueries_2005_201907.sql β†’ SQLServerDiagnosticQueries_2005_201908.sql}
  4. 0 ...ery/{SQLServerDiagnosticQueries_2008R2_201907.sql β†’ SQLServerDiagnosticQueries_2008R2_201908.sql}
  5. 0 ...icquery/{SQLServerDiagnosticQueries_2008_201907.sql β†’ SQLServerDiagnosticQueries_2008_201908.sql}
  6. +1 βˆ’1 ...icquery/{SQLServerDiagnosticQueries_2012_201907.sql β†’ SQLServerDiagnosticQueries_2012_201908.sql}
  7. +1 βˆ’1 ...icquery/{SQLServerDiagnosticQueries_2014_201907.sql β†’ SQLServerDiagnosticQueries_2014_201908.sql}
  8. +1 βˆ’1 ...y/{SQLServerDiagnosticQueries_2016SP2_201907.sql β†’ SQLServerDiagnosticQueries_2016SP2_201908.sql}
  9. +1 βˆ’1 ...icquery/{SQLServerDiagnosticQueries_2016_201907.sql β†’ SQLServerDiagnosticQueries_2016_201908.sql}
  10. +1 βˆ’1 ...icquery/{SQLServerDiagnosticQueries_2017_201907.sql β†’ SQLServerDiagnosticQueries_2017_201908.sql}
  11. +12 βˆ’8 ...icquery/{SQLServerDiagnosticQueries_2019_201907.sql β†’ SQLServerDiagnosticQueries_2019_201908.sql}
  12. +1 βˆ’1 ...sticQueries_AzureSQLDatabase_201907.sql β†’ SQLServerDiagnosticQueries_AzureSQLDatabase_201908.sql}
  13. BIN ...icResults_201907.sql β†’ SQLServerDiagnosticQueries_SQLManagedInstanceDiagnosticResults_201908.sql}
  14. +1 βˆ’1 ...Queries_SQLManagedInstance_201907.sql β†’ SQLServerDiagnosticQueries_SQLManagedInstance_201908.sql}
  15. +1 βˆ’1 dbatools.psd1
  16. +6 βˆ’2 en-us/dbatools-help.xml
[switch]$ExactLength,
[int]$ConnectionTimeout = 0,
[int]$CommandTimeout = 300,
[string[]]$DictionaryFilePath,
[string]$DictionaryExportPath,
[switch]$EnableException
)
begin {
$supportedFakerSubTypes = Get-DbaRandomizedType | Select-Object Subtype -ExpandProperty Subtype -Unique

$supportedFakerSubTypes += "Date"

# Import the dictionary files
if ($DictionaryFilePath.Count -ge 1) {
$dictionary = @{ }

foreach ($file in $DictionaryFilePath) {
Write-Message -Level Verbose -Message "Importing dictionary file '$file'"
if (Test-Path -Path $file) {
try {
# Import the keys and values
$items = Import-Csv -Path $file

# Loop through the items and define the types
foreach ($item in $items) {
if ($item.Type) {
$type = [type]"$($item.type)"
} else {
$type = [type]"string"
}

# Add the item to the hash array
if ($dictionary.Keys -notcontains $item.Key) {
$dictionary.Add($item.Key, ($($item.Value) -as $type))
}
}
} catch {
Stop-Function -Message "Could not import csv data from file '$file'" -ErrorRecord $_ -Target $file
}
} else {
Stop-Function -Message "Could not import dictionary file '$file'" -ErrorRecord $_ -Target $file
}
}
}
}

process {
if ($Table -and $tabletest.Name -notin $Table) {
continue
}

foreach ($columntest in $tabletest.Columns) {
if ($columntest.ColumnType -in 'hierarchyid', 'geography', 'xml', 'geometry' -and $columntest.Name -notin $Column) {
Stop-Function -Message "$($columntest.ColumnType) is not supported, please remove the column $($columntest.Name) from the $($tabletest.Name) table" -Target $tables -Continue
}
}
}

$dictionary = @{ }

foreach ($instance in $SqlInstance) {
try {
$server = Connect-SqlInstance -SqlInstance $instance -SqlCredential $sqlcredential -MinimumVersion 9
}

foreach ($dbname in $Database) {
if (-not $DictionaryFilePath) {
$dictionary = @{ }
}

if ($server.VersionMajor -lt 9) {
Stop-Function -Message "SQL Server version must be 2005 or greater" -Continue
}
$uniqueValues = $null
}

# Commit the transaction and close it
try {
$null = $transaction.Commit()
$sqlconn.Close()
} catch {
Stop-Function -Message "Failure" -Continue -ErrorRecord $_
}
}
}
}
}

# Export the dictionary when needed
if ($DictionaryExportPath) {
try {
if (-not (Test-Path -Path $DictionaryExportPath)) {
New-Item -Path $DictionaryExportPath -ItemType Directory
}

Write-Message -Message "Writing dictionary for $($db.Name)" -Level Verbose

$filenamepart = $server.Name.Replace('\', '$').Replace('TCP:', '').Replace(',', '.')
$dictionaryFileName = "$DictionaryExportPath\$($filenamepart).$($db.Name).Dictionary.csv"

if (-not $script:isWindows) {
$dictionaryFileName = $dictionaryFileName.Replace("\", "/")
}

$dictionary.GetEnumerator() | Sort-Object Key | Select-Object Key, Value, @{Name = "Type"; Expression = { $_.Value.GetType().Name } } | Export-Csv -Path $dictionaryFileName -NoTypeInformation

Get-ChildItem -Path $dictionaryFileName
} catch {
Stop-Function -Message "Something went wrong writing the dictionary to the $DictionaryExportPath" -Target $DictionaryExportPath -Continue -ErrorRecord $_
}
}
} # End foreach database
} # End foreach instance
} # End process block
} # End

#.ExternalHelp dbatools-Help.xml
function Invoke-DbaDbDbccCheckConstraint {

foreach ($line in $fullscript) {
if ($start -eq $false) {
if (($line -match "You have the correct major version of SQL Server for this diagnostic information script") -or ($line.StartsWith("-- Server level queries ***"))) {
if (($line -match "You have the correct major version of SQL Server for this diagnostic information script") -or ($line.StartsWith("-- Server level queries ***") -or ($line.StartsWith("-- Instance level queries ***")))) {
$start = $true
}
continue
"false",
"300"
],
[
"DictionaryFilePath",
"Import the dictionary to be used in in the database masking",
"",
false,
"false",
""
],
[
"DictionaryExportPath",
"Export the dictionary to the given path. Naming convention will be [computername]_[instancename]_[database]_Dictionary.csv\nBe carefull with this feature, this export is the key to get the original values which is a security risk!",
"",
false,
"false",
""
],
[
"EnableException",
"By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.\r\nThis avoids overwhelming you with \"sea of red\" exceptions, but is inconvenient because it basically disables advanced scripting.\r\nUsing this switch turns this \"nice by default\" feature off and enables you to catch exceptions with your own try/catch.",
""
]
],
"Syntax": "Invoke-DbaDbDataMasking [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [-FilePath] \u003cObject\u003e [[-Locale] \u003cString\u003e] [[-CharacterString] \u003cString\u003e] [[-Table] \u003cString[]\u003e] [[-Column] \u003cString[]\u003e] [[-ExcludeTable] \u003cString[]\u003e] [[-ExcludeColumn] \u003cString[]\u003e] [[-Query] \u003cString\u003e] [[-MaxValue] \u003cInt32\u003e] [[-ModulusFactor] \u003cInt32\u003e] [-ExactLength] [[-ConnectionTimeout] \u003cInt32\u003e] [[-CommandTimeout] \u003cInt32\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]"
"Syntax": "Invoke-DbaDbDataMasking [[-SqlInstance] \u003cDbaInstanceParameter[]\u003e] [[-SqlCredential] \u003cPSCredential\u003e] [[-Database] \u003cString[]\u003e] [-FilePath] \u003cObject\u003e [[-Locale] \u003cString\u003e] [[-CharacterString] \u003cString\u003e] [[-Table] \u003cString[]\u003e] [[-Column] \u003cString[]\u003e] [[-ExcludeTable] \u003cString[]\u003e] [[-ExcludeColumn] \u003cString[]\u003e] [[-Query] \u003cString\u003e] [[-MaxValue] \u003cInt32\u003e] [[-ModulusFactor] \u003cInt32\u003e] [-ExactLength] [[-ConnectionTimeout] \u003cInt32\u003e] [[-CommandTimeout] \u003cInt32\u003e] [[-DictionaryFilePath] \u003cString[]\u003e] [[-DictionaryExportPath] \u003cString\u003e] [-EnableException] [-WhatIf] [-Confirm] [\u003cCommonParameters\u003e]"
},
{
"Name": "Invoke-DbaDbDbccCheckConstraint",
@@ -1,7 +1,7 @@

-- SQL Server 2012 Diagnostic Information Queries
-- Glenn Berry
-- Last Modified: July 9, 2019
-- Last Modified: September 4, 2019
-- https://www.sqlskills.com/blogs/glenn/
-- http://sqlserverperformance.wordpress.com/
-- Twitter: GlennAlanBerry
@@ -1,7 +1,7 @@

-- SQL Server 2014 Diagnostic Information Queries
-- Glenn Berry
-- Last Modified: August 1, 2019
-- Last Modified: September 4, 2019
-- https://www.sqlskills.com/blogs/glenn/
-- http://sqlserverperformance.wordpress.com/
-- Twitter: GlennAlanBerry
@@ -1,7 +1,7 @@

-- SQL Server 2016 SP2 Diagnostic Information Queries
-- Glenn Berry
-- Last Modified: August 8, 2019
-- Last Modified: September 4, 2019
-- https://www.sqlskills.com/blogs/glenn/
-- http://sqlserverperformance.wordpress.com/
-- Twitter: GlennAlanBerry
@@ -1,7 +1,7 @@

-- SQL Server 2016 Diagnostic Information Queries
-- Glenn Berry
-- Last Modified: August 8, 2019
-- Last Modified: September 4, 2019
-- https://www.sqlskills.com/blogs/glenn/
-- http://sqlserverperformance.wordpress.com/
-- Twitter: GlennAlanBerry
@@ -1,7 +1,7 @@

-- SQL Server 2017 Diagnostic Information Queries
-- Glenn Berry
-- Last Modified: August 8, 2019
-- Last Modified: September 4, 2019
-- https://www.sqlskills.com/blogs/glenn/
-- http://sqlserverperformance.wordpress.com/
-- Twitter: GlennAlanBerry
@@ -1,7 +1,7 @@

-- SQL Server 2019 Diagnostic Information Queries
-- Glenn Berry
-- Last Modified: August 8, 2019
-- Last Modified: September 10, 2019
-- https://www.sqlskills.com/blogs/glenn/
-- http://sqlserverperformance.wordpress.com/
-- Twitter: GlennAlanBerry
@@ -65,7 +65,9 @@ SELECT @@SERVERNAME AS [Server Name], @@VERSION AS [SQL Server and OS Version In
-- 15.0.1400.75 CTP 2.4 3/26/2019
-- 15.0.1500.28 CTP 2.5 4/23/2019
-- 15.0.1600.8 CTP 3.0 5/22/2019
-- 15.0.1700.37 CTP 3.1 6/26/2019
-- 15.0.1700.37 CTP 3.1 6/26/2019
-- 15.0.1800.32 CTP 3.2 7/24/2019
-- 15.0.1900.25 RC1/RC1 Refresh 8/29/2019



@@ -136,8 +138,8 @@ SERVERPROPERTY('InstanceDefaultDataPath') AS [InstanceDefaultDataPath],
SERVERPROPERTY('InstanceDefaultLogPath') AS [InstanceDefaultLogPath],
SERVERPROPERTY('BuildClrVersion') AS [Build CLR Version],
SERVERPROPERTY('IsXTPSupported') AS [IsXTPSupported],
SERVERPROPERTY('IsPolybaseInstalled') AS [IsPolybaseInstalled], -- New for SQL Server 2016
SERVERPROPERTY('IsAdvancedAnalyticsInstalled') AS [IsRServicesInstalled]; -- New for SQL Server 2016
SERVERPROPERTY('IsPolybaseInstalled') AS [IsPolybaseInstalled],
SERVERPROPERTY('IsAdvancedAnalyticsInstalled') AS [IsRServicesInstalled];
------

-- This gives you a lot of useful information about your instance of SQL Server,
@@ -167,6 +169,7 @@ ORDER BY name OPTION (RECOMPILE);
-- optimize for ad hoc workloads (should be 1)
-- priority boost (should be zero)
-- remote admin connections (should be 1)
-- tempdb metadata memory-optimized (0 by default, some workloads may benefit by enabling)

-- sys.configurations (Transact-SQL)
-- https://bit.ly/2HsyDZI
@@ -322,7 +325,7 @@ FROM sys.dm_os_host_info WITH (NOLOCK) OPTION (RECOMPILE);

-- 1033 for os_language_version is US-English

-- SQL Server 2019 requires Windows Server 2012 or newer (may change by RTM)
-- SQL Server 2019 requires Windows Server 2016 or newer

-- Hardware and Software Requirements for Installing SQL Server
-- https://bit.ly/2y3ka5L
@@ -437,7 +440,8 @@ SELECT cpu_count AS [Logical CPU Count], scheduler_count,
DATEDIFF(hour, sqlserver_start_time, GETDATE()) AS [SQL Server Up Time (hrs)],
virtual_machine_type_desc AS [Virtual Machine Type],
softnuma_configuration_desc AS [Soft NUMA Configuration],
sql_memory_model_desc, container_type_desc -- New in SQL Server 2019
sql_memory_model_desc,
container_type_desc -- New in SQL Server 2019
FROM sys.dm_os_sys_info WITH (NOLOCK) OPTION (RECOMPILE);
------

@@ -740,7 +744,7 @@ db.delayed_durability_desc, db.is_auto_create_stats_incremental_on,
db.is_query_store_on, db.is_sync_with_backup, db.is_temporal_history_retention_enabled,
db.is_supplemental_logging_enabled, db.is_remote_data_archive_enabled,
db.is_encrypted, de.encryption_state, de.percent_complete, de.key_algorithm, de.key_length, db.resource_pool_id,
db.is_tempdb_spill_to_remote_store, db.is_result_set_caching_on, db.is_accelerated_database_recovery_on
db.is_tempdb_spill_to_remote_store, db.is_result_set_caching_on, db.is_accelerated_database_recovery_on, is_stale_page_detection_on
FROM sys.databases AS db WITH (NOLOCK)
INNER JOIN sys.dm_os_performance_counters AS lu WITH (NOLOCK)
ON db.name = lu.instance_name
@@ -933,7 +937,7 @@ AS (SELECT wait_type, wait_time_ms/ 1000.0 AS [WaitS],
N'PREEMPTIVE_OS_PIPEOPS', N'PREEMPTIVE_OS_AUTHENTICATIONOPS',
N'PREEMPTIVE_OS_GENERICOPS', N'PREEMPTIVE_OS_VERIFYTRUST',
N'PREEMPTIVE_OS_FILEOPS', N'PREEMPTIVE_OS_DEVICEOPS', N'PREEMPTIVE_OS_QUERYREGISTRY',
N'PREEMPTIVE_OS_WRITEFILE',
N'PREEMPTIVE_OS_WRITEFILE', N'PREEMPTIVE_OS_WRITEFILEGATHER',
N'PREEMPTIVE_XE_CALLBACKEXECUTE', N'PREEMPTIVE_XE_DISPATCHER',
N'PREEMPTIVE_XE_GETTARGETSTATE', N'PREEMPTIVE_XE_SESSIONCOMMIT',
N'PREEMPTIVE_XE_TARGETINIT', N'PREEMPTIVE_XE_TARGETFINALIZE',
@@ -1,7 +1,7 @@

-- Azure SQL Database Diagnostic Information Queries
-- Glenn Berry
-- Last Modified: August 16, 2019
-- Last Modified: September 4, 2019
-- https://www.sqlskills.com/blogs/glenn/
-- http://sqlserverperformance.wordpress.com/
-- Twitter: GlennAlanBerry
@@ -1,7 +1,7 @@

-- SQL Managed Instance Diagnostic Information Queries
-- Glenn Berry
-- Last Modified: August 8, 2019
-- Last Modified: September 4, 2019
-- https://www.sqlskills.com/blogs/glenn/
-- http://sqlserverperformance.wordpress.com/
-- Twitter: GlennAlanBerry
@@ -11,7 +11,7 @@
RootModule = 'dbatools.psm1'

# Version number of this module.
ModuleVersion = '1.0.42'
ModuleVersion = '1.0.43'

# ID used to uniquely identify this module
GUID = '9d139310-ce45-41ce-8e8b-d76335aa1789'

0 comments on commit 0ff6c76

Please sign in to comment.
You can’t perform that action at this time.