sp_configure#
Lists the server-wide configuration options, shows one of them, or changes the value of an Engine option. The procedure takes SQL Server’s shape, so scripts written for SQL Server run unchanged, and it is the SQL route to a set of Engine settings.
Note
Two parts of SQL Server’s sp_configure are not supported. The SQL Server options Querona mirrors can be read
but not changed (see Options). A change is stored in its own transaction in the metabase, as every metadata
change is, so a change made inside a user transaction is not undone by ROLLBACK, where SQL Server would roll
it back. See Feature support.
Syntax#
sp_configure
[ [ @configname = ] 'option_name'
[ , [ @configvalue = ] value ] ] [;]
Arguments#
[ @configname = ] ‘option_name’
The name of a configuration option, or part of one; sysname, NULL by default. Without it the procedure lists every
option. See Finding an option below.
[ @configvalue = ] value
The new value of the option; int, NULL by default. Without it, or when it is NULL, the procedure only shows the
option.
Result set#
A list, and a call that shows one option, return one row per option, ordered by name, ignoring case:
Column |
Type |
Description |
|---|---|---|
name |
sysname |
The name of the option. |
minimum |
int |
The smallest value the option accepts. |
maximum |
int |
The largest value the option accepts. |
config_value |
int |
The configured value. |
run_value |
int |
The value in use. |
For an Engine option config_value shows the value stored in the metabase, and run_value the one
sys.configurations reports as value_in_use. For the two logon-tracking options it comes from the answering
node’s running configuration, which follows a change made on another node only when the answering node restarts.
For the two inactivity options it comes from the stored value used by the rule. An unusable flush or check interval
is shown as its effective default in run_value: 60 seconds for flushing and 60 minutes for inactivity checks.
config_value still shows the stored value. See In a cluster for when a timer picks up a change. The return value
is 0.
SQL Server declares name as nvarchar(35). Querona declares it as sysname, because its option names are
the Engine’s own setting names, and the longer of them exceed 35 characters. A script or tool that stores the output
of sp_configure in a table whose name column is declared nvarchar(35) fails on those names; declare the
column as sysname.
Options#
The procedure lists two kinds of option.
SQL Server options. Querona mirrors a set of SQL Server’s options, such as clr enabled, so that clients and
scripts that read them find them. They can be read but not changed: a new value is accepted only when it repeats the
current one, which keeps scripts such as EXEC sp_configure 'clr enabled', 0; RECONFIGURE; running, and any other
value is refused with a message that names the option as a SQL Server option Querona only mirrors. Like SQL Server,
the procedure lists an advanced option only while show advanced options is 1; in Querona that option is a mirrored
one with the value 0, so the advanced SQL Server options are not listed and cannot be found by name.
Engine options. These are settings of the Querona Engine. Each value is a whole number in the unit the table gives:
Id |
Option |
Unit |
Range |
Default |
Description |
|---|---|---|---|---|---|
20001 |
|
0 / 1 |
0 - 1 |
1 |
Whether sign-ins are recorded. See Logon tracking settings. |
20002 |
|
seconds |
5 - 86400 |
60 |
How often a node writes the sign-ins it has observed to the metabase. See Logon tracking settings. |
20003 |
|
days |
0 - 3650 |
0 |
How many days an account may go without signing in before it is disabled; 0 switches the rule off. See Security policy settings. |
20004 |
|
minutes |
1 - 1440 |
60 |
How often the check for inactive accounts runs. See Security policy settings. |
The configured value of an Engine option is the one stored in the metabase, which every node of a cluster shares. A stored duration is shown in whole units, truncated toward zero, except that a positive duration shorter than one unit is shown as 1. For example, a stored inactivity period of 12 hours is shown as 1 day. An Engine option is never advanced and is always dynamic; see sys.configurations.
Remarks#
Finding an option#
option_name matches every listed option whose name contains it, ignoring case, and may carry the LIKE wildcards:
'clr' finds clr enabled, and so does 'clr_enabled', because _ stands for any one character. The name
must match exactly one option. A name that matches none is refused with error 15123, and a name that matches more than
one with error 15124, even when it is the full name of one of them. SQL Server follows error 15124 with a
duplicate_options result set naming the matching options; Querona sends the error alone, so list the options with
EXEC sp_configure to find the full name. The name is resolved before
anything else, so an unknown name is answered with 15123 whatever the caller’s permissions.
Changing a value#
A change is checked in this order:
The caller must hold
CONTROL SERVER; otherwise the call is refused with error 15247.A value outside the option’s range is refused with error 15129.
A SQL Server option accepts only its current value, as described under Options.
A change must keep logon tracking and the inactivity rule consistent: a period of inactivity above zero is refused while logon tracking is off, and logon tracking cannot be switched off while the period is above zero. The check is made against the values stored in the metabase.
Only the option named is stored; no other setting is touched, whatever another node or the Administration Portal saved in the meantime. Switching the inactivity rule on stamps the moment from which inactivity is counted, as a save in the portal does. After the change the procedure sends the message SQL Server sends:
Configuration option 'System_Core_LogonTracking_FlushInterval' changed from 60 to 120. Run the RECONFIGURE statement to install.
The message is informational (message 15457) and is sent also when the new value equals the old one. The Engine has no
installation step: a node takes a stored change up as In a cluster describes, and
RECONFIGURE is accepted and changes nothing, so scripts that pair it
with sp_configure keep working.
Under SET NOEXEC ON a call with a value changes nothing, is not audited and sends no message.
The procedure is also reached as sys.sp_configure.
In a cluster#
A stored change shows at once on every node as the configured value (config_value, and value in
sys.configurations). When a node starts running it depends on the option:
Logon tracking. On the node that ran the change, switching tracking on or off applies at once, and a new flush interval is picked up at the next tick of the running flush timer, so within one interval of the old length. Another node follows both at its next start, as after a save in the Administration Portal; until then its
run_valueshows the value it still runs.Inactivity rule. The period and the check interval are enforced from the stored value, whichever node stored it: the primary instance reads both from the metabase at each check, and picks a new check interval up at the next tick of the running check timer, so within one interval of the old length. The rule runs only while logon tracking is on on the primary instance itself.
A cluster node that does not serve refuses a change before it touches the metabase.
A save of the Engine configuration in the Administration Portal writes every setting the portal shows from the values
it loaded, as two portal saves on different nodes already do. A portal save made on a node that has not restarted since
an sp_configure change on another node therefore writes the older values back.
Audit#
A change is audited as SQL Server audits it, with the action ALTER SETTINGS on the class SERVER, also when it
is refused for lack of the permission, so a change made in SQL reaches the audit trail as a save of the Engine
configuration in the Administration Portal does; see Audit logs. The
Engine log also records each change with the option, its old and new value and the login that made it. Reading options
is not audited.
Permissions#
Any login can list and read the options. Changing a value requires the CONTROL SERVER permission.
Examples#
Lists every option, then shows one:
EXEC sp_configure;
EXEC sp_configure 'System_Core_SecurityPolicy_DisableInactiveLoginsAfter';
Disables the logins that have not signed in for 92 days, and checks every 30 minutes:
EXEC sp_configure 'System_Core_SecurityPolicy_DisableInactiveLoginsAfter', 92;
EXEC sp_configure 'System_Core_SecurityPolicy_InactivityCheckInterval', 30;
RECONFIGURE;