< Back

Find-DbaDbGrowthEvent

Mon Jan 13, 2020 10:07 am

NAME Find-DbaDbGrowthEvent



SYNOPSIS

Finds any database AutoGrow events in the Default Trace.





SYNTAX

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

[[-SqlCredential] <Pscredential>] [[-Database] <System.Object[]>] [[-ExcludeDatabase] <System.Object[]>]

[[-EventType] <String>] [[-FileType] <String>] [-UseLocalTime <Switch>] [-EnableException <Switch>]

[<CommonParameters>]





DESCRIPTION

Finds any database AutoGrow events in the Default Trace.



The following events are included:



92 - Data File Auto Grow



93 - Log File Auto Grow



94 - Data File Auto Shrink



95 - Log File Auto Shrink





PARAMETERS

-Database [<System.Object[]>]

The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will

be processed.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-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



-EventType [<String>]

Provide a filter on growth event type to filter the results.



Allowed values: Growth, Shrink



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-ExcludeDatabase [<System.Object[]>]

The database(s) to exclude - this list is auto-populated from the server



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-FileType [<String>]

Provide a filter on file type to filter the results.



Allowed values: Data, Log



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. This can be a collection and receive pipeline input to allow the

function to be executed against multiple SQL Server instances.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-UseLocalTime [<Switch>]

Return the local time of the instance instead of converting to UTC.



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: AutoGrow,Growth,Database

Author: Aaron Nelson



Website: https://dbatools.io

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

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



Query Extracted from SQL Server Management Studio (SSMS) 2016.



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



PS C:\\>Find-DbaDbGrowthEvent -SqlInstance localhost



Returns any database AutoGrow events in the Default Trace with UTC time for the instance for every database on the

localhost instance.

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



PS C:\\>Find-DbaDbGrowthEvent -SqlInstance localhost -UseLocalTime



Returns any database AutoGrow events in the Default Trace with the local time of the instance for every database

on the localhost instance.

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



PS C:\\>Find-DbaDbGrowthEvent -SqlInstance ServerA\\SQL2016, ServerA\\SQL2014



Returns any database AutoGrow events in the Default Traces for every database on ServerA\\sql2016 & ServerA\\SQL2014.

-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Find-DbaDbGrowthEvent -SqlInstance ServerA\\SQL2016 | Format-Table -AutoSize -Wrap



Returns any database AutoGrow events in the Default Trace for every database on the ServerA\\SQL2016 instance in a

table format.

-------------------------- EXAMPLE 5 --------------------------



PS C:\\>Find-DbaDbGrowthEvent -SqlInstance ServerA\\SQL2016 -EventType Shrink



Returns any database Auto Shrink events in the Default Trace for every database on the ServerA\\SQL2016 instance.

-------------------------- EXAMPLE 6 --------------------------



PS C:\\>Find-DbaDbGrowthEvent -SqlInstance ServerA\\SQL2016 -EventType Growth -FileType Data



Returns any database Auto Growth events on data files in the Default Trace for every database on the

ServerA\\SQL2016 instance.



RELATED LINKS

https://dbatools.io/Find-DbaDbGrowthEvent