Thor Logo dbatools

Memory

Clear-DbaPlanCache

Tracy Boggiano, databasesuperhero.com

Clear-DbaPlanCache View Source Tracy Boggiano, databasesuperhero.com Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Clears SQL Server plan cache when single-use adhoc and prepared plans exceed memory threshold Description Monitors your SQL Server’s plan cache for single-use adhoc and prepared plans that consume excessive memory. When these plans exceed the specified threshold (default 100MB), the function clears the entire plan cache using DBCC FREESYSTEMCACHE(‘SQL Plans’).

Read more

Get-DbaDbccMemoryStatus

Patrick Flynn (@sqllensman)

Get-DbaDbccMemoryStatus View Source Patrick Flynn (@sqllensman) Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Executes DBCC MEMORYSTATUS and returns memory usage details in a structured format Description Runs DBCC MEMORYSTATUS against SQL Server instances and parses the output into a structured PowerShell object for analysis. This replaces the need to manually execute DBCC MEMORYSTATUS and interpret its raw text output, making memory troubleshooting and monitoring much easier.

Read more

Get-DbaDbMemoryUsage

Shawn Melton (@wsmelton), wsmelton.github.io

Get-DbaDbMemoryUsage View Source Shawn Melton (@wsmelton), wsmelton.github.io Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Retrieves detailed buffer pool memory consumption by database and page type for performance analysis. Description Analyzes SQL Server buffer pool memory usage by querying sys.dm_os_buffer_descriptors to show exactly how much memory each database consumes, broken down by page type (data pages, index pages, etc.). This helps DBAs identify memory-hungry databases that may be impacting instance performance and guides decisions about memory allocation, database optimization, or server capacity planning.

Read more

Get-DbaMaxMemory

Chrissy LeMaire (@cl), netnerds.net

Get-DbaMaxMemory View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Retrieves SQL Server max memory configuration and compares it to total physical server memory Description This command retrieves the SQL Server ‘Max Server Memory’ configuration setting alongside the total physical memory installed on the server. This comparison helps identify potential memory configuration issues that can impact SQL Server performance.

Read more

Get-DbaMemoryCondition

IJeb Reitsma

Get-DbaMemoryCondition View Source IJeb Reitsma Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Retrieves memory pressure notifications and utilization metrics from SQL Server resource monitor ring buffers. Description Analyzes SQL Server’s internal resource monitor ring buffers to identify memory pressure events and track memory utilization over time. This helps DBAs diagnose performance issues caused by insufficient memory, excessive paging, or memory pressure conditions that trigger automatic memory adjustments.

Read more

Get-DbaMemoryUsage

Klaas Vandenberghe (@PowerDBAKlaas)

Get-DbaMemoryUsage View Source Klaas Vandenberghe (@PowerDBAKlaas) Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Collects memory usage statistics from all SQL Server services using Windows performance counters Description Collects detailed memory usage from SQL Server Database Engine, Analysis Services (SSAS), and Integration Services (SSIS) using Windows performance counters. This helps you troubleshoot memory pressure issues and understand how memory is allocated across different SQL Server components on the same server.

Read more

Get-DbaPlanCache

Tracy Boggiano, databasesuperhero.com

Get-DbaPlanCache View Source Tracy Boggiano, databasesuperhero.com Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Retrieves single-use plan cache usage to identify memory waste from adhoc and prepared statements Description Analyzes the plan cache to identify memory consumed by single-use adhoc and prepared statements that are unlikely to be reused. These plans accumulate over time and can consume significant memory without providing performance benefits.

Read more

Get-DbaStartupParameter

Chrissy LeMaire (@cl), netnerds.net

Get-DbaStartupParameter View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Retrieves SQL Server startup parameters from the Windows service configuration Description Extracts and parses SQL Server startup parameters directly from the Windows service configuration using WMI. Returns detailed information about file paths (master database, transaction log, error log), trace flags, debug flags, and special startup modes like single-user or minimal start.

Read more

Set-DbaMaxMemory

Chrissy LeMaire (@cl), netnerds.net

Set-DbaMaxMemory View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Configures SQL Server ‘Max Server Memory’ setting using calculated recommendations or explicit values Description Modifies the SQL Server ‘Max Server Memory’ configuration to prevent SQL Server from consuming all available system memory. This setting controls how much memory SQL Server can allocate for its buffer pool and other memory consumers, leaving

Read more

Test-DbaMaxMemory

Chrissy LeMaire (@cl), netnerds.net

Test-DbaMaxMemory View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS On this page: Synopsis · Description · Syntax · Examples · Parameters · Outputs Synopsis Calculates recommended SQL Server max memory settings to prevent OS memory pressure and optimize performance. Description Analyzes server memory and SQL Server instances to calculate optimal max memory configuration settings. Uses a tiered algorithm that reserves appropriate memory for the operating system based on total server memory, accounting for multiple SQL instances and other SQL services like SSAS, SSRS, or SSIS.

Read more