< Back

Test-DbaMaxDop

Mon Jan 13, 2020 6:13 pm

NAME Test-DbaMaxDop



SYNOPSIS

Displays information relating to SQL Server Max Degree of Parallelism setting. Works on SQL Server 2005-2016.





SYNTAX

Test-DbaMaxDop [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]> [[-SqlCredential]

<Pscredential>] [-EnableException <Switch>] [<CommonParameters>]





DESCRIPTION

Inspired by Sakthivel Chidambaram's post about SQL Server MAXDOP Calculator

(https://blogs.msdn.microsoft.com/sqlsak ... alculator/),



this script displays a SQL Server's: max dop configured, and the calculated recommendation.



For SQL Server 2016 shows:



- Instance max dop configured and the calculated recommendation



- max dop configured per database (new feature)



More info:



https://support.microsoft.com/en-us/kb/2806535



https://blogs.msdn.microsoft.com/sqlsak ... es-my-job-

easier/



These are just general recommendations for SQL Server and are a good starting point for setting the "max degree of

parallelism" option.





PARAMETERS

-EnableException [<Switch>]

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.

This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables

advanced scripting.

Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own

try/catch.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-SqlCredential [<Pscredential>]

Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential).



Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory -

Integrated are all supported.



For MFA support, please use Connect-DbaInstance.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]

The target SQL Server instance or instances.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

System.Collections.ArrayList





NOTES





Tags: MaxDop, SpConfigure

Author: Claudio Silva (@claudioessilva)



Website: https://dbatools.io

Copyright: (c) 2018 by dbatools, licensed under MIT

License: MIT https://opensource.org/licenses/MIT



Requires: sysadmin access on SQL Servers



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Test-DbaMaxDop -SqlInstance sql2008, sqlserver2012



Get Max DOP setting for servers sql2008 and sqlserver2012 and also the recommended one.

-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Test-DbaMaxDop -SqlInstance sql2014 | Select-Object *



Shows Max DOP setting for server sql2014 with the recommended value. Piping the output to Select-Object * will

also show the 'NumaNodes' and 'NumberOfCores' of each instance

-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Test-DbaMaxDop -SqlInstance sqlserver2016 | Select-Object *



Get Max DOP setting for servers sql2016 with the recommended value. Piping the output to Select-Object * will also

show the 'NumaNodes' and 'NumberOfCores' of each instance. Because it is an 2016 instance will be shown

'InstanceVersion', 'Database' and 'DatabaseMaxDop' columns.



RELATED LINKS

https://dbatools.io/Test-DbaMaxDop