exec sp_configure 'show advanced options',1
RECONFIGURE
exec sp_configure 'Ad Hoc Distributed Queries',1
RECONFIGURE 

运行以上语句报错,报错内容如下:
Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install.
Msg 5808, Level 16, State 1, Line 49
Ad hoc update to system catalogs is not supported.

最后改为以下就不会报错
exec sp_configure 'show advanced options',1
RECONFIGURE  WITH OVERRIDE
exec sp_configure 'Ad Hoc Distributed Queries',1
RECONFIGURE WITH OVERRIDE

运行结果如下:
Configuration
option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install. Configuration option 'Ad Hoc Distributed Queries' changed from 1 to 1. Run the RECONFIGURE statement to install.

关于RECONFIGURERECONFIGURE WITH OVERRIDE的区别,我查阅的在线文档是这样解释的:

与此相反,RECONFIGURE WITH OVERRIDE 则接受具有正确数据类型的任何选项值,并使用指定的值强制进行重新配置。

RECONFIGURE 我们需要知道以下情况:

与此相反,重新配置 fill factor 选项的运行值时,则需要重新启动数据库引擎。

还可以通过查看 sys.configurations 目录视图的 is_dynamic 列来确定哪些选项是动态的。

value 值过高,则 run_value 列将反映这样的事实:数据库引擎默认使用动态内存,而不使用无效设置。

 

相关文章: