Setting SQL Server Configuration Options with AWS RDS Parameter Groups

Problem

Amazon Relational Database Service (Amazon RDS) is a web service that makes it easier to set up, operate, and scale a relational database in the cloud. But, RDS does not currently support all features of SQL Server that you might be used to. In order to deliver a managed service experience, Amazon RDS does not provide shell access to database instances and it restricts access to certain system procedures and tables that require advanced privileges. Amazon RDS supports access to databases on an instance using any standard SQL client application, but some system tools, like sp_configure are not available as a way to set server level settings. You can run sp_configure and see the configuration values, but you can’t change them directly in SQL Server.

In this tip we look at how you can still manage some of these settings even though some tools are locked down.

Solution

When using AWS RDS, you manage your database engine configuration through the use of parameters in a database parameter group. Default parameter groups are automatically created from a default parameter template when you create a database instance for a particular database engine and version. These default parameter groups contain preferred parameter settings and cannot be modified. When you create a custom parameter group, you can modify parameter settings.

Using SP_CONFIGURE on AWS RDS

You can still run sp_configure to see the configuration values, such as cost threshold for parallelism, but if you try to change you will get an error saying you don’t have permission to perform the action.

sp_configure

RDS Parameter Groups

To set parameters, you need to setup a parameter group.  You can see the parameter groups available in the image below and if you don’t have any setup you can click on "Create parameter group" to create a new group where you can configure parameters.

rds parameter groups

Here is the screen to setup a new parameter group.

rds create parameter group

With the new parameter group you can now change configuration values that you used to previously change using sp_configure. For instance, I’m going to change the cost threshold for parallelism from the default value of 5.

Type "parallelism" in the parameter group filter to show only the parallelism options.  Once we find the parameter we want to adjust, we can click on "Edit parameters" and then save the value.

rds edit parameter

Complete List of AWS RDS Parameters for SQL Server

Here is a list of the parameters that can be adjusted using this approach.

ParameterDescription
1204Returns the resources and types of locks participating in a deadlock and also the current command affected.
1211Disables lock escalation based on memory pressure or based on number of locks. The SQL Server Database Engine will not escalate row or page locks to table locks.
1222Returns the resources and types of locks that are participating in a deadlock and also the current command affected, in an XML format that does not comply with any XSD schema.
1224Disables lock escalation based on the number of locks. However, memory pressure can still activate lock escalation.
2528Disables parallel checking of objects by DBCC CHECKDB, DBCC CHECKFILEGROUP, and DBCC CHECKTABLE.
3205Disables hardware compression for tape drivers.
3226Suppresses log entries for backup operations.
3625Limits the amount of information returned in error messages.
4199Controls multiple query optimizer changes previously made under multiple trace flags.
4616Makes server-level metadata visible to application roles.
6527Disables generation of a memory dump on the first occurrence of an out-of-memory exception in CLR integration.
7806Enables a dedicated administrator connection (DAC) on SQL Server Express.
access check cache bucket countNumber of buckets used by the internal access check result cache
access check cache quotaNumber of entries used by the internal access check result cache
ad hoc distributed queriesEnables ad hoc distributed queries using OPENROWSET and OPENDATASOURCE
affinity i/o maskBinds disk I/O to specified subset of CPUs
affinity maskDynamically controls CPU affinity
agent xpsEnables the SQL Server Agent extended stored procedures on this serve
allow polybase exportAllows INSERT into a Hadoop external table
allow updatesSetting has no effect
automatic soft-numa disabledAutomatic soft-NUMA is enabled by default
c2 audit modeEnables C2 auditing
clr enabledWhether assemblies can be run by SQL Server
clr strict securityclr strict security
contained database authenticationEnables contained databases authentication to create or attach contained databases to Database Engine without authenticating a login at the Database Engine level
cost threshold for parallelismThreshold at which Microsoft SQL Server creates and runs parallel plans for queries
cross db ownership chainingConfigures cross-database ownership chaining for an instance of Microsoft SQL Server
cursor thresholdNumber of rows in the cursor set at which cursor keysets are generated asynchronously
database mail xpsEnables Database Mail on the server
default full-text languageDefault language value for full-text indexed columns
default languageDefault language for all newly created logins
default trace enabledEnables or disable the default trace log files
disallow results from triggersWhether triggers can return result sets
external scripts enabledAllows execution of external scripts
filestream access levelChanges the FILESTREAM access level for this instance of SQL Server
fill factor (%)Server-wide default fill-factor value
ft crawl bandwidth (max)Maximum size to which the pool of large memory buffers can grow for full-text searching
ft crawl bandwidth (min)Minimum size to which the pool of large memory buffers can grow for full-text searching
ft notify bandwidth (max)Maximum size to which the pool of small memory buffers can grow for full-text searching
ft notify bandwidth (min)Minimum size to which the pool of small memory buffers can grow for full-text searching
in-doubt xact resolutionControls default outcome of transactions that the Microsoft Distributed Transaction Coordinator (MS DTC) is unable to resolve
index create memory (kb)Maximum amount of memory initially allocated for creating indexes
lightweight poolingWhether to switch to fiber mode scheduling
locksMaximum number of available locks
max degree of parallelismNumber of processors to use in a parallel plan execution
max full-text crawl rangeNumber of partitions that Microsoft SQL Server should use during a full index crawl
max server memory (mb)Maximum amount of memory in megabytes in the buffer pool used by an instance of Microsoft SQL Server
max text repl size (b)Maximum size in bytes of text, ntext, varchar(max), nvarchar(max), varbinary(max), xml, and image data that can be added to a replicated column or captured in a single INSERT, UPDATE, WRITETEXT, or UPDATETEXT statement
max worker threadsNumber of worker threads available to Microsoft SQL Server processes
media retentionSystem-wide default length of time to retain each backup set
min memory per query (kb)Minimum amount of memory in kilobytes that are allocated for the execution of a query
min server memory (mb)Minimum amount of memory in megabytes in the buffer pool used by an instance of Microsoft SQL Server
nested triggersControls whether an AFTER trigger can cascade
network packet size (b)Packet size (in bytes) used across the entire network
ole automation proceduresWhether OLE Automation objects can be instantiated within Transact-SQL batches
open objectsSetting has no effect
optimize for ad hoc workloadsImprove efficiency of the plan cache for workloads that contain many single use ad hoc batches
ph timeout (s)Time, in seconds, that the full-text protocol handler should wait to connect to a database before timing-out
polybase network encryptionConfigures SQL Server to encrypt control and data channels when using PolyBase
priority boostWhether Microsoft SQL Server should run at a higher Windows Server scheduling priority than other processes on the same computer
query governor cost limitUpper limit on the time period in which query can run
query wait (s)Time in seconds that a query waits for resources before timing out
rds.fipsFIPS enforcement.
rds.force_sslForce SSL connections.
recovery interval (min)Maximum number of minutes per database that Microsoft SQL Server needs to recover databases
remote accessControl the execution of stored procedure from local or remote servers on which instances of Microsoft SQL Server are running
remote admin connectionsEnables client applications on remote computers to use the dedicated administrator connection (DAC)
remote data archiveAllows the use of the REMOTE_DATA_ARCHIVE data access for databases
remote login timeout (s)Number of seconds to wait before returning from a failed attempt to log in to a remote server
remote proc transProtects the actions of a server-to-server procedure through a Microsoft Distributed Transaction Coordinator (MS DTC) transaction
remote query timeout (s)How long, in seconds, a remote operation can take before Microsoft SQL Server times out
replication xpsInternal use only
scan for startup procsScans for automatic execution of stored procedures at Microsoft SQL Server startup time
server trigger recursionWhether to allow server-level triggers to fire recursively
set working set sizeSetting has no effect
show advanced optionsDisplay the sp_configure system stored procedure advanced options
smo and dmo xpsEnables SQL Server Management Object (SMO) and SQL Distributed Management Object (SQL-DMO) extended stored procedures on this server
transform noise wordsSuppresses an error message if noise words cause a Boolean operation on a full-text query to return zero rows
two digit year cutoffCutoff year for interpreting two-digit years as four-digit years
user connectionsMaximum number of simultaneous user connections. Please note that the service may use up to 40 connections for system maintenance
user optionsSpecify global default query processing options for all users
xp_cmdshellEnables whether the xp_cmdshell extended stored procedure can be executed on the system

You can see a few trace flags and xp_cmdshell, but not everything can be adjusted.

If we try to change xp_cmdshell as shown below, an error will appear.

rds parameter group error

Using PowerShell to Change AWS RDS Parameters

I suggest using PowerShell to change parameters. For example, I quickly created a script in PowerShell to change the cost thresholds for parallelism as shown below.

set rds parameter with PowerShell

Conclusion

Amazon RDS has limitations to manage database configurations, but there are parameters you can work with. To configure your environment, parameter groups can solve some of the limitations that RDS creates like setting parallelism on SQL Server, although you cannot change everything as we saw above.

As I described, there are a couple of ways to change the configurations that you don’t have direct access on RDS using parameter groups. Following the above steps might increase the number of parameter groups, because the defaults aren’t the best configuration for your database.

In addition, there is a question about security because anyone with rights to change parameter groups can change your database configurations. So, it’s good to stay alert when making configuration changes and keep a log of the changes.

Next Steps

Leave a Reply

Your email address will not be published. Required fields are marked *