< Back

Test-DbaTempDbConfig

Mon Jan 13, 2020 6:17 pm

NAME Test-DbaTempDbConfig



SYNOPSIS

Evaluates tempdb against several rules to match best practices.





SYNTAX

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

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





DESCRIPTION

Evaluates tempdb against a set of rules to match best practices. The rules are:



* TF 1118 enabled - Is Trace Flag 1118 enabled (See KB328551).



* File Count - Does the count of data files in tempdb match the number of logical cores, up to 8?



* File Growth - Are any files set to have percentage growth? Best practice is all files have an explicit growth

value.



* File Location - Is tempdb located on the C:\\? Best practice says to locate it elsewhere.



* File MaxSize Set (optional) - Do any files have a max size value? Max size could cause tempdb problems if it

isn't allowed to grow.



* Data File Size Equal - Are the sizes of all the tempdb data files the same?



Other rules can be added at a future date.





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. SQL Server 2005 and higher are supported.



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



NOTES





Tags: Tempdb, Configuration

Author: Michael Fal (@Mike_Fal), http://mikefal.net



Website: https://dbatools.io

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

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



Based on Amit Bannerjee's (@banerjeeamit) Get-TempDB function

(https://github.com/amitmsft/SqlOnAzureV ... bFiles.ps1)



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



PS C:\\>Test-DbaTempDbConfig -SqlInstance localhost



Checks tempdb on the localhost machine.

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



PS C:\\>Test-DbaTempDbConfig -SqlInstance localhost | Select-Object *



Checks tempdb on the localhost machine. All rest results are shown.

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



PS C:\\>Get-DbaRegServer -SqlInstance sqlserver2014a | Test-DbaTempDbConfig | Select-Object * | Out-GridView



Checks tempdb configuration for a group of servers from SQL Server Central Management Server (CMS). Output

includes all columns. Send output to GridView.



RELATED LINKS

https://dbatools.io/Test-DbaTempddbConfig