代码改变世界

sp_configure错误:不支持对系统目录进行即席更新。

2013-12-31 15:44  潇湘隐者  阅读(24198)  评论(6编辑  收藏  举报

    今天在一台数据库服务器上(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 行  不支持对系统目录进行即席更新”。

Code Snippet
  1. EXEC sp_configure'show advanced options', 1;
  2.  
  3. GO
  4.  
  5. RECONFIGURE;
  6.  
  7. GO
  8.  
  9. Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install.
  10.  
  11. 消息 5808,级别 16,状态 1,第 1 行 
  12. Ad hoc update to system catalogs is not supported.

但是如果我将RECONFIGURE 改为RECONFIGURE WITH OVERRIDE 则OK,不会有上面错误。

Code Snippet
  1. EXEC sp_configure'show advanced options', 1;
  2.  
  3. GO
  4.  
  5. RECONFIGURE WITH OVERRIDE;
  6.  
  7. GO
  8.  
  9. 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
  1. EXEC sp_configure 'allow_updates'
  2.  
  3.      name         minimum     maximum   config_value run_value
  4.  
  5. ------------- ----------- ----------- ------------ -----------
  6.  
  7.  allow updates      0           1           1            1
  8.  
  9. EXEC sp_configure 'allow_updates',0;
  10.  
  11. GO
  12.  
  13. RECONFIGURE WITH OVERRIDE;
  14.  
  15. GO
  16.  
  17. EXEC sp_configure 'show advanced options', 1;
  18.  
  19. GO
  20.  
  21. RECONFIGURE;
  22.  
  23. GO
  24.  
  25. Configuration option 'show advanced options' changed from 0 to 1. Run the RECONFIGURE statement to install.
  26.  
  27. EXEC sp_configure'show advanced options', 1;
  28.  
  29. GO
  30.  
  31. RECONFIGURE;
  32.  
  33. GO
  34. 配置选项 'show advanced options' 已从 1 更改为 1。请运行 RECONFIGURE 语句进行安装