< Back

Get-DbaWaitResource

Mon Jan 13, 2020 11:49 am

NAME Get-DbaWaitResource



SYNOPSIS

Returns the resource being waited upon





SYNTAX

Get-DbaWaitResource [-SqlInstance] <DbaInstanceParameter> [[-SqlCredential] <Pscredential>] [-WaitResource]

<String> [-Row <Switch>] [-EnableException <Switch>] [<CommonParameters>]





DESCRIPTION

Given a wait resource in the form of 'PAGE: 10:1:9180084' returns the database, data file and the system object

which is being waited up.



Given a wait resource in the form of 'KEY: 7:35457594073541168 (de21f92a1572)', returns the database, object and

index that is being waited on, With the -row switch the row data will also be returned.





PARAMETERS

-EnableException [<Switch>]

Replaces user friendly yellow warnings with bloody red exceptions of doom!

Use this if you want the function to throw terminating errors you want to catch.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Row [<Switch>]

If this switch provided also returns the value of the row being waited on with KEY wait resources



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 [<DbaInstanceParameter>]

The target SQL Server instance or instances.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-WaitResource [<String>]

The wait resource value as supplied in sys.dm_exec_requests



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: Pages, DBCC

Author: Stuart Moore (@napalmgram), stuart-moore.com



Website: https://dbatools.io

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

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



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



PS C:\\>Get-DbaWaitResource -SqlInstance server1 -WaitResource 'PAGE: 10:1:9180084'



Will return an object containing; database name, data file name, schema name and the object which owns the resource

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



PS C:\\>Get-DbaWaitResource -SqlInstance server2 -WaitResource 'KEY: 7:35457594073541168 (de21f92a1572)'



Will return an object containing; database name, schema name and index name which is being waited on.

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



PS C:\\>Get-DbaWaitResource -SqlInstance server2 -WaitResource 'KEY: 7:35457594073541168 (de21f92a1572)' -row



Will return an object containing; database name, schema name and index name which is being waited on, and in

addition the contents of the locked row at the time the command is run.



RELATED LINKS

https://dbatools.io/Get-DbaWaitResource