通用 sp_configure 设置与 RECONFIGURE
SQL Server配置命令
EXEC sys.sp_configure 'show advanced options', 1;
RECONFIGURE;
-- Example: cost threshold for parallelism and MAXDOP:
EXEC sys.sp_configure 'cost threshold for parallelism', 50;
EXEC sys.sp_configure 'max degree of parallelism', 4;
RECONFIGURE;
-- Show all configured/running values:
SELECT name, value AS configured, value_in_use AS running, is_dynamic, is_advanced
FROM sys.configurations
ORDER BY name;作用
设置服务器级配置值;RECONFIGURE 将其应用到运行值。
适用场景
更改 MAXDOP、并行度阈值或 optimize for ad hoc workloads 等服务器设置时。
注意
is_dynamic = 0 的设置需要重启 SQL Server。RECONFIGURE WITH OVERRIDE 会跳过某些设置的验证;请谨慎使用。更改前记下 value_in_use。