Changing configuration settings with sp_configure

5

September 22, 2014 by Kenneth Fisher

I was recently asked where to go in Configuration Manager to change the settings for xp_cmdshell. It was then that I realized that the existence of sp_configure is probably not universal knowledge. I was truly shocked. For some reason I had thought that DBA’s were born with this knowledge. As this turns out not to be the case, I felt it would be a good idea to give sp_configure a brief run through.

Quick disclaimer: This stored procedure modifies system settings. Be sure you understand the setting you are changing and the need for the change before making it.

The system stored procedure sp_configure is used to view or modify a number of different system settings. These settings include the default MAXDOP for the server, whether SMOs is enabled, whether xp_cmdshell is enabled and a long list of others. To get a complete list you can either query sys.configurations or run sp_configure with no parameters.

At this point you might have a couple of questions:

  • Why is the list from sp_configure shorter than the list from sys.configurations?
  • If I can enable xp_cmdshell using sp_configure, why isn’t that setting showing up?

 
The answer to both of these is the same. Some configurations are considered Advanced. If you want to see them you will need to change the setting show advanced options (using of course sp_configure).

EXEC sp_configure 'show advanced options', 1 
RECONFIGURE

“But wait,” you’re wondering “Why are you are adding in this RECONFIGURE command?”

Because sp_configure only changes the configured value. RECONFIGURE updates the running value with the configured value (there are a few exceptions where a reboot or instance restart is required). So in order to actually change the currently running configuration value you have to use both commands. Fortunately RECONFIGURE checks that the configured value is valid before setting it as the running value. If you are absolutely certain you know what you are doing and need to update one of the configuration values with something outside of its allowed range you can include the WITH OVERRIDE option of the RECONFIGURE command.

So here’s the thing, if you are going to be administrating SQL Server you need to have at least a passing familiarity of the sp_configure and RECONFIGURE commands and a reasonable idea of what settings they modify.

5 thoughts on “Changing configuration settings with sp_configure

  1. Bill says:

    One feature of sp_configure is that you only need to type enough of the configuration name fore it to be recognizable. For example, sp_configure ‘show’, 1 is sufficient for ‘show advanced’ (try ‘sh’ :)).

    If someone insists upon using the SSMS GUI (to enable xp_cmdshell), right click the sever name, select Facets and explore the options. MS’ decision to use the word ‘facet’ was a poor one, IMO (and that is why I remember the name :)). My guess is that the word ‘configure’ has been over-used since 4.0 :).

  2. […] Settings – Check the contents of sys.configurations and the expected location of each of the system […]

  3. […] majority of the instance settings can be updated using sp_configure. And in fact you can use sp_configure to list out all of the settings it can update. It’s […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 2,151 other followers

Follow me on Twitter

ToadWorld Pro of the Month November 2013
%d bloggers like this: