今天在一台数据库服务器上(Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64) Standard Edition (64-bit))使用sp_configure更改当前服务器的全局配置设置时,遇到错误提示为“消息 5808,级别 16,状态 1,第 1 行 Ad hoc update to system catalogs is not supported”,通常对应的中文错误提示为:“消息 5808,级别 16,状态 1,第 1 行 不支持对系统目录进行即席更新”。html
Code Snippet数据库
EXEC sp_configure'show advanced options', 1;服务器
GOapp
RECONFIGURE;ide
GOpost
Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install.this
消息 5808,级别 16,状态 1,第 1 行 url
Ad hoc update to system catalogs is not supported.spa
可是若是我将RECONFIGURE 改成RECONFIGURE WITH OVERRIDE 则OK,不会有上面错误。code
Code Snippet
EXEC sp_configure'show advanced options', 1;
GO
RECONFIGURE WITH OVERRIDE;
GO
Configuration option 'show advanced options' changed from 0 to 1. Run the RECONFIGURE statement to install.
MSDN关于 RECONFIGURE 和 RECONFIGURE WITH OVERRIDE的解释:
RECONFIGURE
指定若是配置设置不须要服务器中止并从新启动,则更新当前运行的值。RECONFIGURE 还会检查新的配置值中是否有无效值(例如,在 syscharsets 中不存在的排序顺序值)或非建议值。对于那些不须要服务器中止并从新启动的配置选项,其当前运行的值和当前配置的值在指定 RECONFIGURE 以后应当相同。
WITH OVERRIDE
禁用对 recoveryinterval 高级配置选项的配置值检查(以查找无效值或非建议值)。
任何配置选项均可以经过使用 WITH OVERRIDE 选项来从新配置。另外,RECONFIGURE WITH OVERRIDE 使用指定值强制从新配置。例如,可以使用大于maxservermemory 配置选项中指定的值来配置minservermemory 配置选项。可是,这将被认为是错误。所以,指定 RECONFIGURE WITH OVERRIDE 将不由用配置值检查。
通常形成上面错误的缘由是由于allow_updates被设置为1,关于allow updates选项的MSDN解释
allow updates Option
This option is still present in the sp_configure stored procedure, although its functionality is unavailable in SQL Server. The setting has no effect. Starting with SQL Server 2005, direct updates to the system tables are not supported.
Important:
This feature will be removed in a future version of Microsoft SQL Server. Do not use this feature in new development work, and modify applications that currently use this feature as soon as possible.
Changing the allow updates option will cause the RECONFIGURE statement to fail. Changes to the allow updates option should be removed from all scripts.
此选项仍然存在于 sp_configure 存储过程当中,可是其功能在 SQL Server 中不可用。其设置不起做用。从 SQL Server 2005 开始,不支持直接更新系统表
更改 allow updates 选项将致使 RECONFIGURE 语句失败。 应当从全部脚本中删除对 allow updates 选项的更改。
我检查了一下数据库关于'allow_updates' 选项的config_value和 run_value,果真发现其值为1,使用sp_configure将其置为0后,使用RECONFIGURE时,不会出现上面错误
Code Snippet
EXEC sp_configure 'allow_updates'
name minimum maximum config_value run_value
------------- ----------- ----------- ------------ -----------
allow updates 0 1 1 1
EXEC sp_configure 'allow_updates',0;
GO
RECONFIGURE WITH OVERRIDE;