Author | Shawn Melton (@wsmelton), wsmelton.github.io |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Get-DbaDbMemoryUsage on GitHub.
Want to see the Bill Of Health for this command? Check out Get-DbaDbMemoryUsage.
Determine buffer pool usage by database.
This command can be utilized to determine which databases on a given instance are consuming buffer pool memory.
This command is based on query provided by Aaron Bertrand.
Reference: https://www.mssqltips.com/sqlservertip/2393/determine-sql-server-memory-use-by-database-and-object/
Get-DbaDbMemoryUsage
[-SqlInstance] <DbaInstanceParameter[]>
[[-SqlCredential] <PSCredential>]
[[-Database] <Object[]>]
[[-ExcludeDatabase] <Object[]>]
[-IncludeSystemDb]
[-EnableException]
[<CommonParameters>]
PS C:\> Get-DbaDbMemoryUsage -SqlInstance sqlserver2014a
Returns the buffer pool consumption for all user databases
PS C:\> Get-DbaDbMemoryUsage -SqlInstance sqlserver2014a -IncludeSystemDb
Returns the buffer pool consumption for all user databases and system databases
PS C:\> Get-DbaDbMemoryUsage -SqlInstance sql1 -IncludeSystemDb -Database tempdb
Returns the buffer pool consumption for tempdb database only
PS C:\> Get-DbaDbMemoryUsage -SqlInstance sql2 -IncludeSystemDb -Exclude 'master','model','msdb','ResourceDb'
Returns the buffer pool consumption for all user databases and tempdb database
The target SQL Server instance or instances.
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
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..
Alias | |
Required | False |
Pipeline | false |
Default Value |
The database(s) to process - this list is auto-populated from the server. If unspecified, all databases will be processed.
Alias | |
Required | False |
Pipeline | true (ByPropertyName) |
Default Value |
The database(s) to exclude.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Switch to have the output include system database memory consumption.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
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.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |