Detailed Guide to Configure SQL Sever Memory Best Practice

What is SQL Server memory best practice? When configure SQL Server memory, following best practices can help to improve performance and stability which is critical for enterprise.

By @Amelia Last Updated October 17, 2024

The management of SQL Server Memory is important to remain high performance and efficiency for database operations. Having a proper memory configuration is critical, otherwise, it can lead to performance degradation and resource contention.

Best Practice for SQL Server Memory Configuration

Efficient SQL Server memory maintains smooth system performance, while proper memory configuration prevents resource contention and ensures that programs on the same server can coexist. This next section will focus on SQL Server memory best practices.

Set Appropriate Max and Min Server Memory

The SQL Max Server memory setting should be based on the total physical memory of the system. A usual rule is to leave at least 4GB or 10% of available memory for the operating system. The SQL Minimum Server memory, although it is optional, can ensure the SQL Server does not drop below a certain threshold to stabilize memory usage. Following the below steps can help to set Max Server memory.

Step 1. Open SQL Server Management Studio (SSMS), in the Object Explorer, right-click a server and select Properties.

Step 2. Select Memory, then the current values of max server memory and min server memory will display.

Step 3. In the Server memory options, enter the numbers you want to change for max server memory and min server memory.

Enable Lock Pages in Memory (LPIM)

When the SQL Server Memory is paged by operating system, performance will be impacted. LPIM can avoid performance problems. You can follow these steps to enable Lock Pages in Memory.

Step 1. Open Local Group Policy Editor (gpedit.msc), navigate to Computer Configuration > Windows Settings > Security Settings > Local Policies > User Rights Assignment.

Step 2. Double-click Lock Page in Memory, then click Add User or Group. After adding user or group, click OK.

Step 3. Click Restart to restart SQL Server for the change to take effect.

Monitor Memory Usage

It’s essential to regularly monitor SQL Server memory usage, this process can help you to configure appropriate memory. You can use SQL Server Management Studio (SSMS) to monitor. Check memory usage under Performance Dashboard.

How to Check SQL Server Memory Allocation

Checking SQL Server memory allocation is critical for performance monitoring and ensuring that SQL Server runs efficiently. Below is a brief overview of some of the ways to check SQL Server memory allocation.

1. Check SQL Server Memory Allocation Settings

You can use the following command to check the minimum and maximum memory limits set for SQL Server:

EXEC sp_configure 'show advanced options', 1; RECONFIGURE; EXEC sp_configure 'min server memory (MB)'; EXEC sp_configure 'max server memory (MB)';

2. Check Current SQL Server Memory Usage

Using this command to check how much SQL Server memory is currently using:

sys.dm_os_process_memory

3. Check Memory Clerk Usage

You can use the following command to see how memory is allocated in memory clerk:

SELECT type, SUM(pages_kb) / 1024 AS MemoryUsage_MB FROM sys.dm_os_memory_clerks GROUP BY type >ORDER BY MemoryUsage_MB DESC;

Professional SQL Server Backup Software - AOMEI Cyber Backup

When improper management of SQL Server memory can lead to data loss, also poor memory configuration can put data at risk. AOMEI Cyber Backup is a versatile and user-friendly SQL Server backup software, you can use it easily schedule automated backups, ensuring your SQL Server databases are consistently protected.

Using AOMEI Cyber Backup, can also enjoy these features:

✍Scheduling and Automation: With AOMEI Cyber Backup, you can set up automatic SQL backups to reduce the risk of data loss due to human error or unexpected events. ✍Flexible Backup Methods: It offers full, incremental, and differential backups as well as a retention policy. ✍Easy to Restore: Restore SQL databases to another computer through an intuitive interface without complicated backup procedures. ✍Multiple Backup Options: You can store your data in various locations such as local disks, network drives, or cloud storage, providing flexibility and redundancy. ✍Centralized Backup: It offers a flexible backup method and is able to backup all the devices within LAN.

Download Free TrialMicrosoft SQL Server 2005-2022
Centralized and Secure SQL Backup

How to Backup SQL Server Database with Simple Steps

Step 1. Navigate to Source Device > Microsoft SQL > Add Microsoft SQL. Download proxy program and install it on the device with SQL Server installed. Then click Already installed proxy and select the device with SQL installed. Click ... > Authentication to validate the database instance.

Step 2. Navigate to Backup Task and click + Create New Task to open the create new task page. Then choose Microsoft SQL Backup as the backup type, also you can try VMware backup.

Step 3. Click Device Name to specify the SQL instances and databases that you need to back up. You can select one or multiple databases.

Step 4. Select Target to store the backup. You can specify a local or network path, and the added path will be saved in the Added storage.

Step 5. Set up Schedule to automatically run database backup. You can choose the backup method as full, incremental, or differential.

Step 6. Configure Backup Cleanup to automatically delete historical backup versions based on rules to save storage space.

Step 7. Click Start Backup to begin the task. You can select Add the schedule and start backup now or Add the schedule only.

*Note: You can open the Email Notification to monitor the backup status, it will send you an email to notify the abnormal performance.

Conclusion

Managing and having the right configuration of SQL Server memory is not indispensable if you want your databases to run smoothly, and having the right configuration ensures that SQL Server runs efficiently. Although improper configuration can also lead to data loss, AOMEI Cyber Backup can bridge this gap to ensure data security and help you back up your files to SQL Server.